AttributeError: 'thread._local' object has no attribute '_pydal_connection_4411274960_42929'

109 views
Skip to first unread message

黄祥

unread,
May 20, 2018, 9:08:34 PM5/20/18
to web2py-users
usually installed new web2py app smoothly with step below using python preinstalled os (2.7.10), but when using conda (python 2.7.15) it's return an error:
step:
cd
rm -rf ~/python/web2py/applications/test
cp -R ~/python/web2py/applications/welcome/ ~/python/web2py/applications/test
rsync -zavr ~/git/web2py/test ~/python/web2py/applications/
rsync -zavur ~/git/web2py/test ~/python/web2py/applications/

Traceback (most recent call last):
  File "/Users/sugizo/python/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/Users/sugizo/python/web2py/applications/test/controllers/install_demo.py", line 596, in <module>
  File "/Users/sugizo/python/web2py/gluon/globals.py", line 419, in <lambda>
    self._caller = lambda f: f()
  File "/Users/sugizo/python/web2py/applications/test/controllers/install_demo.py", line 413, in index
    'nav_per_unit' : 1317.3918, 'previous_nav_per_unit' : 1316.93},
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/objects.py", line 862, in bulk_insert
    for f in self._after_insert]
  File "applications/test/modules/test_callback.py", line 206, in after_insert_nav
    if row_account.investor.notification:
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/helpers/classes.py", line 220, in __getattr__
    self.__allocate()
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/helpers/classes.py", line 209, in __allocate
    self._record = self._table[long(self)]
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/objects.py", line 542, in __getitem__
    orderby_on_limitby=False
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/objects.py", line 2250, in select
    return adapter.select(self.query, fields, attributes)
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", line 82, in select
    return super(SQLite, self).select(query, fields, attributes)
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/adapters/base.py", line 762, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/adapters/base.py", line 718, in _select_aux
    rows = self._select_aux_execute(sql)
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/adapters/base.py", line 712, in _select_aux_execute
    self.execute(sql)
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 63, in wrap
    if not args[0].connection:
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/connection.py", line 36, in connection
    return getattr(THREAD_LOCAL, self._connection_uname_)
AttributeError: 'thread._local' object has no attribute '_pydal_connection_4411274960_42929'

In file: /Users/sugizo/python/web2py/applications/test/controllers/install_demo.py
<code object <module> at 0x108c794b0, file "/Users/sugizo/python/web2py/applications/test/controllers/install_demo.py", line 3>

web2py version:
2.16.1-stable+timestamp.2017.11.14.05.54.25 (Running on Rocket 1.2.6, Python 2.7.15)

any idea?

thanks and best regards,
stifan

黄祥

unread,
May 20, 2018, 10:41:33 PM5/20/18
to web2py-users
found the culprit is on the python version (not affected by the pre installed os or conda), already tested in conda python version from 2.7.10 till 2.7.14 is running well, when using 2.7.15 (latest) is return an error above
step for tested in conda that running well
conda create -y -n python2714_test python=2.7.14
source activate python2714_test
python -V
python ~/python/web2py/web2py.py --nogui --no-banner -a a -i 0.0.0.0 -p 8000

cd
rm -rf ~/python/web2py/applications/test
cp -R ~/python/web2py/applications/welcome/ ~/python/web2py/applications/test
rsync -zavr ~/git/web2py/test ~/python/web2py/applications/
rsync -zavur ~/git/web2py/test ~/python/web2py/applications/

but still can't find solution for 2.7.15 version, any hint?
Reply all
Reply to author
Forward
0 new messages