Compile Error

41 views
Skip to first unread message

Anand Kulkarni

unread,
Jul 12, 2021, 8:56:21 AM7/12/21
to Sahana-Eden
Hi Team,

I'm getting the following error on compile, can you please help me with it?



root@GLBLRSVPSAHA01:/home/web2py# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/compile.py
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2021
Version 2.21.1-stable+timestamp.2020.11.27.18.21.43
Database drivers available: sqlite3, imaplib, pyodbc, pymysql
Traceback (most recent call last):
  File "/home/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications/eden/models/00_tables.py", line 47, in <module>
    import s3db.pr
  File "/home/web2py/gluon/custom_import.py", line 74, in custom_importer
    modules_prefix, globals, locals, (itemname,), level)
  File "applications/eden/modules/s3db/pr.py", line 5175
    ).first()
    ^
SyntaxError: invalid syntax


Thanks and Regards,
Anand A Kulkarni

Dominic König

unread,
Jul 12, 2021, 12:22:52 PM7/12/21
to sahan...@googlegroups.com
That looks very much like the wrong Python version.

You need Python-3.5+ to run Sahana.

Dominic
> --
> You received this message because you are subscribed to the Google Groups
> "Sahana-Eden" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to sahana-eden...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sahana-eden/83bd7e86-1cee-4c3d-99c1-401d7
> b412a10n%40googlegroups.com.

signature.asc
Message has been deleted

Anand Kulkarni

unread,
Jul 13, 2021, 2:05:17 AM7/13/21
to Sahana-Eden
HI Dominic,

Thanks, I have updated my python from 2.7 to 3.7, but now I'm facing the following issue.

root@GLBLRSVPSAHA01:/home/web2py# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/compile.py
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2021
Version 2.21.1-stable+timestamp.2020.11.27.18.21.43
Database drivers available: sqlite3, imaplib, pymysql, pyodbc
Traceback (most recent call last):
  File "/home/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications/eden/models/00_utils.py", line 39, in <module>
    auth.s3_set_roles()
  File "/home/web2py/applications/eden/modules/s3/s3aaa.py", line 3846, in s3_set_roles
    system_roles = self.get_system_roles()
  File "/home/web2py/applications/eden/modules/s3/s3aaa.py", line 3782, in get_system_roles
    rows = current.db(query).select(gtable.id, gtable.uuid)
  File "/home/web2py/gluon/packages/dal/pydal/objects.py", line 2649, in select
    return adapter.select(self.query, fields, attributes)
  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 885, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 842, in _select_aux
    rows = self._select_aux_execute(sql)
  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 836, in _select_aux_execute
    self.execute(sql)
  File "/home/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 65, in wrap
    if not args[0].connection:
  File "/home/web2py/gluon/packages/dal/pydal/connection.py", line 32, in connection
    return self.get_connection()
  File "/home/web2py/gluon/packages/dal/pydal/connection.py", line 65, in get_connection
    connection = self.connector()
  File "/home/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 61, in connector
    conn = self.driver.connect(**self.driver_args)
  File "/home/web2py/gluon/contrib/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/home/web2py/gluon/contrib/pymysql/connections.py", line 688, in __init__
    self.connect()
  File "/home/web2py/gluon/contrib/pymysql/connections.py", line 905, in connect
    self._get_server_information()
  File "/home/web2py/gluon/contrib/pymysql/connections.py", line 1231, in _get_server_information
    self.server_charset = charset_by_id(lang).name
  File "/home/web2py/gluon/contrib/pymysql/charset.py", line 38, in by_id
    return self._by_id[id]
KeyError: 255

Dominic König

unread,
Jul 13, 2021, 2:21:27 AM7/13/21
to sahan...@googlegroups.com
Well,

obviously, you will now need to install the corresponding Python-3 modules,
like dateutil, lxml, etc (see requirements.txt) - you will have had them with
your Python-2 installation, but they do not automatically upgrade when you
switch the Python version.

Dominic

tisdag 13 juli 2021 kl. 07:12:38 CEST skrev Anand Kulkarni:
> Hello Dominic,
>
> I have updated python fron 2.7 to 3.7, But now I'm facing ImportError: No
> module named applications.eden.modules.dateutil.
>
>
> root@GLBLRSVPSAHA01:/home/web2py# python --version
> Python 3.7.3
> root@GLBLRSVPSAHA01:/home/web2py# python web2py.py -S eden -M -R
> applications/eden/static/scripts/tools/compile.py
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2021
> Version 2.21.1-stable+timestamp.2020.11.27.18.21.43
> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
> ERROR: python-dateutil module needed for date handling
> Traceback (most recent call last):
> File "/home/web2py/gluon/custom_import.py", line 78, in custom_importer
> result = sys.modules[modules_prefix]
> KeyError: 'applications.eden.modules.dateutil'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/home/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> File "applications/eden/models/00_db.py", line 87, in <module>
> import s3 as s3base
> File "/home/web2py/gluon/custom_import.py", line 74, in custom_importer
> modules_prefix, globals, locals, (itemname,), level)
> File "/home/web2py/applications/eden/modules/s3/__init__.py", line 45, in
> <module>
> from .s3validators import *
> File "/home/web2py/gluon/custom_import.py", line 87, in custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> File "/home/web2py/applications/eden/modules/s3/s3validators.py", line
> 73, in <module>
> from .s3datetime import S3DateTime
> File "/home/web2py/gluon/custom_import.py", line 87, in custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> File "/home/web2py/applications/eden/modules/s3/s3datetime.py", line 49,
> in <module>
> import dateutil
> File "/home/web2py/gluon/custom_import.py", line 80, in custom_importer
> raise ImportError("No module named %s" % modules_prefix)
> ImportError: No module named applications.eden.modules.dateutil
>
> Thanks & Regards,
> Anand A Kulkarni.
>
> On Monday, July 12, 2021 at 9:52:52 PM UTC+5:30 Dominic wrote:
> https://groups.google.com/d/msgid/sahana-eden/314f79b8-b081-4cc4-b0eb-5e80f
> d0e290dn%40googlegroups.com.

signature.asc

Anand Kulkarni

unread,
Jul 13, 2021, 8:28:32 AM7/13/21
to Sahana-Eden
I have upgraded the  Python-3 modules but still facing exact same issue.

Thanks & Regards,
Anand A Kulkarni,

Anand Kulkarni

unread,
Jul 13, 2021, 8:56:25 AM7/13/21
to Sahana-Eden
Sorry my bad python2 was not uninstalled properly. But now I'm getting  "RuntimeError: Template not found:" even though templates is present in modules/templates location.

root@GLBLRSVPSAHA01:/home/web2py# python3 web2py.py -S eden -M -R applications/eden/static/scripts/tools/compile.py
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2021
Version 2.21.1-stable+timestamp.2020.11.27.18.21.43
Database drivers available: sqlite3, imaplib, pymysql, pyodbc
Traceback (most recent call last):
  File "/home/web2py/applications/eden/modules/s3cfg.py", line 337, in import_template
    template = getattr(__import__(package, fromlist=[config]), config)
  File "/home/web2py/gluon/custom_import.py", line 85, in custom_importer
    return base_importer(pname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'applications.eden.modules.templates.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications/eden/models/000_config.py", line 226, in <module>
    settings.import_template()
  File "/home/web2py/applications/eden/modules/s3cfg.py", line 339, in import_template
    raise RuntimeError("Template not found: %s" % name)
RuntimeError: Template not found:

Dominic König

unread,
Jul 13, 2021, 9:35:20 AM7/13/21
to sahan...@googlegroups.com
ModuleNotFoundError: No module named 'applications.eden.modules.templates.'

...means, no template-name was provided, i.e. settings.base.template is an
empty string "". That's not going to work, I'm afraid - you must specify a
template.

Dominic
> https://groups.google.com/d/msgid/sahana-eden/c29dc4fa-1a72-4925-abd2-18569
> 5ef4c67n%40googlegroups.com.

signature.asc

Anand Kulkarni

unread,
Jul 13, 2021, 9:57:46 AM7/13/21
to Sahana-Eden
Thanks Dominic, 
Solution worked for me, I had to copy the templates,

        cp ~web2py/applications/eden/modules/templates/000_config.py ~web2py/applications/eden/models

Thanks a lot, you saved my day.

Reply all
Reply to author
Forward
0 new messages