Errors running status_checks.py in vers .54

I think that’s the issue right there. At least I think mailinabox uses python3.
I messed up earlier, please try the following again (notice the - l)

ls -l /usr/local/lib/mailinabox/env/bin/python*
lrwxrwxrwx 1 root root       7 Feb 27  2019 /usr/local/lib/mailinabox/env/bin/python -> python3
-rwxr-xr-x 1 root root    2347 Feb 27  2019 /usr/local/lib/mailinabox/env/bin/python-config
-rwxr-xr-x 1 root root 4522328 Feb 27  2019 /usr/local/lib/mailinabox/env/bin/python3
lrwxrwxrwx 1 root root       7 Feb 27  2019 /usr/local/lib/mailinabox/env/bin/python3.6 -> python3

Question: Does this mean that MAIB is using Python3 as default? If so, why do I still get weird syntax errors like the following when I run status_checks.py:

  File "status_checks.py", line 479
    mail_aliases = dict([(address, receivers) for address, receivers, *_ in get_mail_aliases(env)])
                                                                      ^
SyntaxError: invalid syntax

So I followed your previous instructions and instead of typing python, I typed python3. Here is the result of the script:

Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getfilesystemencoding()
'ascii'
>>> sys.getdefaultencoding()
'utf-8'
>>> exit()

So in python3, the defaultencoding IS UTF-8. Huh.

Yeah, my command replication skills are failing me :frowning:
There were a number of changes between python 2 and 3 so some changes surrounding utf8 are expected.
We finally caught up to the wild goose, sorry to have lead you along, but I’m not sure how to proceed :frowning: Searching for the python filesystemencoding leads once again to the locale settings as mentioned by davness.

This might be a last resort. If it works you know at least that indeed the encoding is to blame, but that leaves you without an explanation on why you’re experiencing this.

That statement is on the second line of status_checks.py. I still get this error message:

 File "status_checks.py", line 479
    mail_aliases = dict([(address, receivers) for address, receivers, *_ in get_mail_aliases(env)])
                                                                      ^
SyntaxError: invalid syntax

At this point, I dunno. I get emails properly for any status changes; I can access every other page in administration. I just cannot access the System Status Checks admin page. I just keep getting the message “Something went wrong, sorry.” message.

I haven’t checked ALL the files, but dns_update.py also throws a similar syntax error.

Well, I don’t know what to add at this point, so let’s hope mail will keep on to be delivered :grinning:

I really appreciate your help – even though there was no resolution. I expanded my knowledge of Python and MAIB a tiny bit and that’s always a good thing. In all of this, email and DNS have been working flawlessly. On the web interface, I can access everything except the System Status Checks page.

I have opened an issue for the syntax errors in Github. Hopefully, there will be some kind of feedback either letting me know it’s my server/software/installation with a possible fix, or the next upgrade will have fixed the syntax errors.

Thanks again for your help!

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.