我试图运行在使用用下面的命令模型的命令行脚本:
c:\web2py>python web2py.py -M -N -S automate -R applications/automate/modules/eventserver.py
但我不断收到错误:
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.99.7 (2012-03-04 22:12:08) stable
Database drivers available: SQLite3, pymysql, pg8000, IMAP
Traceback (most recent call last):
File "c:\web2py\gluon\shell.py", line 206, in run
execfile(startfile, _env)
File "applications/automate/modules/eventserver.py", line 6, in <module>
deviceHandler = devicehandler.DeviceHandler()
File "applications\automate\modules\devicehandler.py", line 10, in __init__
self.devices = self.getActiveDevices()
File "applications\automate\modules\devicehandler.py", line 18, in getActiveDe
vices
print db
NameError: global name 'db' is not defined
我究竟做错了什么?
编辑:从我的研究,我只找到了解决办法“-M添加到您的命令”,但我已经这样做了,它仍然不起作用。
EDIT2:我有DB = DAL( 'sqlite的://storage.sqlite')在我db.py所以它应该得到加载