由于某些原因我昨天上传了我的应用引擎项目(在此之前,一切正常),它找不到我的.py文件/模块之一。我的目录如下:
app_directory/
gaesessions/
__init__.py
lib/
httplib2/
__init__.py
other stuff
app.yaml
appengine_config.py
index.yaml
All other .py files/modules
出于某种原因,我现在收到以下错误:
import_string() failed for 'games.GetMyGames'. Possible reasons are:
- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;
Original exception:
ImportError: cannot import name GameModel
答案 0 :(得分:1)
我意识到我有一个循环导入:
在File1.py
中from File2 import class1
并在File2.py
中from File1 import class3
我改为: 在File1.py
中import File2
并在File2.py
中import File1
我将所有类的导入从File1和File2进一步向下移动了文件,这解决了我的问题。希望这有助于其他人。