1

Topic: iRedAdmin 2.5 - Invalid Syntax Error

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.1
- Deployed with iRedMail Easy or the downloadable installer? Yes (but a long time ago)
- Linux/BSD distribution name and version: Debian 9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
- Python Version: 3.5.3
- PHP Version: 8.0.17
====

Hi all,

While updating my iRedMail from version 1.6.1 to 1.6.3 I managed to break iRedAdmin as I was asked to update to version 2.5 of iRedAdmin and the log from the execution of the upgrade_iredadmin.sh bproduced the below error in the output.

Traceback (most recent call last):
  File "delete_sessions.py", line 15, in <module>
    import web
  File "/opt/www/iRedAdmin-2.3/tools/../web/__init__.py", line 4, in <module>
    from . import (  # noqa: F401
  File "/opt/www/iRedAdmin-2.3/tools/../web/db.py", line 757
    f"{round(b - a, 2)} ({self.ctx.dbq_count}): {str(sql_query)}",
                                                                ^
SyntaxError: invalid syntax

Now when i go to access iRedAdmin through a web browser i get a 500 Internal Server Error and below are the messages from the apache error log.

[Tue Jan 02 17:09:19.108687 2024] [wsgi:info] [pid 813] [remote <server-IP>:12605] mod_wsgi (pid=813, process='iredadmin', application=''): Loading Python script file '/opt/www/iredadmin/iredadmin.py'.
[Tue Jan 02 17:09:19.118143 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605] mod_wsgi (pid=813): Failed to exec Python script file '/opt/www/iredadmin/iredadmin.py'.
[Tue Jan 02 17:09:19.118191 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605] mod_wsgi (pid=813): Exception occurred processing WSGI script '/opt/www/iredadmin/iredadmin.py'.
[Tue Jan 02 17:09:19.121779 2024] [ssl:info] [pid 874] [client <server-IP>:12619] AH01964: Connection to child 1 established (server <hostname>:443)
[Tue Jan 02 17:09:19.126810 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605] Traceback (most recent call last):
[Tue Jan 02 17:09:19.126847 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]   File "/opt/www/iredadmin/iredadmin.py", line 8, in <module>
[Tue Jan 02 17:09:19.126851 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]     from libs import iredbase
[Tue Jan 02 17:09:19.126856 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]   File "/opt/www/iredadmin/libs/iredbase.py", line 5, in <module>
[Tue Jan 02 17:09:19.126858 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]     import web
[Tue Jan 02 17:09:19.126863 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]   File "/opt/www/iredadmin/web/__init__.py", line 4, in <module>
[Tue Jan 02 17:09:19.126865 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]     from . import (  # noqa: F401
[Tue Jan 02 17:09:19.126877 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]   File "/opt/www/iredadmin/web/db.py", line 757
[Tue Jan 02 17:09:19.126884 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]     f"{round(b - a, 2)} ({self.ctx.dbq_count}): {str(sql_query)}",
[Tue Jan 02 17:09:19.126909 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605]                                                                 ^
[Tue Jan 02 17:09:19.127140 2024] [wsgi:error] [pid 813] [remote <server-IP>:12605] SyntaxError: invalid syntax
[Tue Jan 02 17:09:39.177960 2024] [reqtimeout:info] [pid 874] [client <server-IP>:12619] AH01382: Request header read timeout



Any help would be good as I am struggling to work out how to fix this.

Thanks,
slm858uk

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedAdmin 2.5 - Invalid Syntax Error

Latest iRedAdmin(-Pro) requires Python 3.x, does your Debian 9 has Python 3.5.x or newer version?

3

Re: iRedAdmin 2.5 - Invalid Syntax Error

Hi Zhang,  my Debian 9 system has Python v3.5.3.

4

Re: iRedAdmin 2.5 - Invalid Syntax Error

Please consider upgrading to at least Debian 10 to get newer Python software.

Also, according to https://wiki.debian.org/DebianReleases:

- Debian 9 was End-Of-Life on 2020-07-18.
- Debian 10 was End-Of-Life on 2022-09-10.
- Debian 11 will be End-Of-Life in 2024-07 (6 months from now on).