正如Storm文档中所述,我正在执行以下操作以导入使用Storm的必要符号:
from storm.locals import *
我正在和Pylons一起使用它,并且风暴确实作为一个鸡蛋安装在Pylon为我设置的虚拟Python环境中,它还搜索正确的路径。
但是,当评估上面的导入代码时,抛出以下异常:
ImportError:没有名为local
的模块
但是我并没有明确地包含来自名为“local”的模块,而是“locals”。
更新(追溯)
URL: http://localhost:5000/characters/index
File '/home/andy/pylon-env/lib/python2.6/site-packages/WebError-0.10.1-py2.6.egg/weberror/evalexception.py', line 431 in respond
app_iter = self.application(environ, detect_start_response)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Beaker-1.3.1-py2.6.egg/beaker/middleware.py', line 70 in __call__
return self.app(environ, start_response)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Beaker-1.3.1-py2.6.egg/beaker/middleware.py', line 149 in __call__
return self.wrap_app(environ, session_start_response)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Routes-1.10.3-py2.6.egg/routes/middleware.py', line 130 in __call__
response = self.app(environ, start_response)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/wsgiapp.py', line 124 in __call__
controller = self.resolve(environ, start_response)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/wsgiapp.py', line 263 in resolve
return self.find_controller(controller)
File '/home/andy/pylon-env/lib/python2.6/site-packages/Pylons-0.9.7-py2.6.egg/pylons/wsgiapp.py', line 284 in find_controller
__import__(full_module_name)
File '/home/andy/projects/evecharacters/evecharacters/controllers/characters.py', line 9 in <module>
from storm.local import *
ImportError: No module named local
答案 0 :(得分:1)
这是失败的代码。
File '/home/andy/projects/evecharacters/evecharacters/controllers/characters.py', line 9 in <module>
from storm.local import *
ImportError: No module named local
您声称自己的代码段是
from storm.locals import *
但错误追溯说
from storm.local import *
我认为追溯是正确的,文件是
/home/andy/projects/evecharacters/evecharacters/controllers/characters.py',第9行
代码from storm.local import *
不正确。不是你想要的代码。