I solved the thread.local error by declaring the rows=db(db.health).select() as a global object in my code. I hope I won't get into trouble. Thanks @ Anthony.
On Sun, 22 Apr 2018, 22:48 Maurice Waka <[email protected]> wrote: > I looked at my question, the reference function was actually a typo, my > apology, it was supposed to be definition(). > I worked it out again as follows: > *model:* > > db = DAL('sqlite://storage.sqlite', migrate=False, fake_migrate=False) > response.generic_patterns = ['*'] if request.is_local else [] > auth = Auth(db, hmac_key=Auth.get_or_create_key()) > auth.define_tables() > crud, service, plugins = Crud(db), Service(), PluginManager() > current.db= db > db.define_table('definition', > Field('definition', 'text', length= 1000000, default="We'll update > soon.", notnull=True)) > > > > *module:#define code* > > from gluon import current > from pydal import DAL, Field > db = current.db > > def definition(): > rows = db(db.definition).select() > for row in rows: > return row.definition > > With this , the error disappeared but when running the code in web2py, i > now have a new headache: > > File > "applications/Hestque_Wellness/modules/Hestquewell/abnvalinterpretation/wellabnvalinterpret0.py", > line 101, in wellabnvalinterpret > rows = db(db.health).select() > File "/usr/local/lib/python2.7/dist-packages/pydal/objects.py", line 2250, > in select > return adapter.select(self.query, fields, attributes) > File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/sqlite.py", > line 82, in select > return super(SQLite, self).select(query, fields, attributes) > File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line > 762, in select > return self._select_aux(sql, fields, attributes, colnames) > File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line > 718, in _select_aux > rows = self._select_aux_execute(sql) > File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line > 712, in _select_aux_execute > self.execute(sql) > File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/__init__.py", > line 63, in wrap > if not args[0].connection: > File "/usr/local/lib/python2.7/dist-packages/pydal/connection.py", line 36, > in connection > return getattr(THREAD_LOCAL, self._connection_uname_) > AttributeError: 'thread._local' object has no attribute > '_pydal_connection_140327873342608_17719' > > > The module wellabnvalinterpret0 imports definition()function. It accesses > the health db. > > Kind regards > > On Sun, Apr 22, 2018 at 9:00 PM, Maurice Waka <[email protected]> > wrote: > >> Will send it once I get back to the comp >> >> On Sun, 22 Apr 2018, 20:55 Anthony <[email protected]> wrote: >> >>> Can't help without the code. >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/7xCGTfc6xAA/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

