I want to run code in the shell, so I wrote two functions and imported it.
The following happens:


In [1]: from opdateerxartikels import *
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/js/web2py/<ipython console> in <module>()

/home/js/web2py/opdateerxartikels.py in <module>()
     58
     59     return
     60
---> 61 lys = db(db.xartikel.id > 0).select()
     62 opdateer_xartikel(db, lys)

NameError: name 'db' is not defined

In [2]:  lys = db(db.xartikel.id > 0).select()


There is no error.

When I load the code without lines 61 and 62 it imports without error.
I then run line 61 without a problem from the command line
Line 62 causes the same problem because in the two functions I do database
lookups and again it ends in in the same NameError.

I have not seen this before.

Version: Version 1.89.5 (2010-11-21 22:12:54)

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
                                                    2 Pet. 1:2b,3a

Reply via email to