Sorry, am still experiencing the same issue. This module is one of the many that I import to the controller . i.e.
controller: from gluon import current db = current.db from ..path/to/module import my_module some code.. def access_this(): class Filters(object): @staticmethod def Filter_read(): for item in strings.split(): for c in abnvalinterpret: here i access the data: strings, lists etc. The data is then accessed by the function below return my_module() On Tue, Apr 17, 2018 at 7:31 AM, Maurice Waka <mauricew...@gmail.com> wrote: > I hadn't done that. I'll redo > Regards > > On Tue, Apr 17, 2018 at 7:26 AM, Dave S <snidely....@gmail.com> wrote: > >> >> >> On Monday, April 16, 2018 at 9:04:35 PM UTC-7, Maurice Waka wrote: >>> >>> from this >>> <https://stackoverflow.com/questions/11959719/web2py-db-is-not-defined> >>> link, i tried accessing values in db as follows: >>> >>> >>> model: >>> >>> db.define_table('abnvalinterprets', >>> Field('abnvalinterpret', length= 1000000),) >>> >>> >>> Module: >>> >>> from gluon import current, DAL, Field >>> >> >> [missing newline inserted] >> >> >>> def abnvalinterpret(): >>> db = current.db >>> db.define_table('abnvalinterprets',Field('abnvalinterpret', 'text', >>> length=1000000)) >>> rows = db().select(db.abnvalinterprets.abnvalinterpret.ALL) >>> for row in rows: >>> print row.abnvalinterpret >>> abnvalinterpret() >>> >>> >>> >>> >>> I keep getting this error: >>> line 4, in abnvalinterpret >>> db = current.db >>> AttributeError: 'thread._local' object has no attribute 'db' >>> >>> Am testing if my module can access/print out data from the database. I >>> hope that is the correct function too. >>> Regards >>> >> >> >> Did you set current.db in the controller that calls your module? >> >> Also, I think you shouldn't re-define the table in your module. >> >> /dps >> >> -- >> 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/to >> pic/web2py/wBVbeSdbc9o/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.