You don't need to run the import as web2py will automatically import the required modules.

Your error comes because you haven't defined your 'db' variable. You must first define your 'db' variable which defines the connection to the database.

Example:

>>> db = DAL('sqlite://database')
>>> rows = db(db.mytable.id > 0)


--Jay



On 03/29/2010 12:05 AM, Matthew wrote:
I'm trying to use web2py in the interactive console, but I'm getting
NameErrors when accessing 'db'. The strange thing is, just a few days
ago I was able to do this. Here is what I'm running:

python web2py.py -S myapp
from gluon.sql import *
rows = db(db.mytable.id>  0)
Traceback (most recent call last):
   File "<console>", line 1, in<module>
NameError: name 'db' is not defined

Any reason the console would not be able to find 'db' now? I did not
change anything on my system.


--
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to