I'm having trouble running a module in the web2py shell.  It's having
difficulty with a db query that I execute with no problems in any
controller.  Here's the traceback:


Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/www-data/web2py/gluon/custom_import.py", line 280, in
__call__
    fromlist, level)
  File "/home/www-data/web2py/gluon/custom_import.py", line 74, in
__call__
    level)
  File "applications/baristacode/modules/real_addcard.py", line 37, in
<module>
    rows = db(db.card.number==cardnum).select()
  File "/home/www-data/web2py/gluon/dal.py", line 4331, in __getattr__
    return self[key]
  File "/home/www-data/web2py/gluon/dal.py", line 4325, in __getitem__
    return dict.__getitem__(self, str(key))
KeyError: 'card'
>>>


I use "python web2py.py -S app -M" and I always check to be sure the
db is available in the shell, as well as the models.  I'm also able to
execute the query by itself in the shell, but when it's in a module, I
get the KeyError above.

I've tried importing the module and using execfile, and in both cases
the script runs fine until the first db query.

Any hints or suggestions?

Thank you,

Eric

Reply via email to