1

出于某种原因,当我昨天上传我的应用程序引擎项目时(在此之前,一切正常),它找不到我的 .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
4

1 回答 1

1

我意识到我有一个循环导入:

在 File1.py 中

from File2 import class1

并在 File2.py

from File1 import class3

我改为:在 File1.py

import File2

并在 File2.py

import File1

我将所有从 File1 和 File2 导入的类移到了文件的下方,这解决了我的问题。希望这对其他人有帮助。

于 2013-03-03T02:25:25.567 回答