On Jan 11, 2012, at 11:49 AM, Chris wrote:

> I am getting an error when I run the following script in my web2py
> directory:
> 
> # python web2py.py -S init -R scripts/sessions2trash.py
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2011
> Version 1.99.2 (2011-09-26 06:55:33) stable
> Database drivers available: SQLite3, PostgreSQL, mongoDB
> Traceback (most recent call last):
>  File "/var/web2py/cow/gluon/shell.py", line 206, in run
>    execfile(startfile, _env)
>  File "scripts/sessions2trash.py", line 222, in <module>
>    main()
>  File "scripts/sessions2trash.py", line 211, in main
>    set_db.trash()
>  File "scripts/sessions2trash.py", line 53, in trash
>    for item in self.get():
>  File "scripts/sessions2trash.py", line 98, in get
>    if tablename in db:
> NameError: global name 'db' is not defined
> 
> Is there something getting stuck here? My models/db.py file depends on
> a lot of other model files and modules, so perhaps it has something to
> do with that.

Try adding -M to your command line.

Reply via email to