1

For some reason when I uploaded my app engine project yesterday (before this, everything worked fine), it can't find one of my .py files/modules. My directory is as follows:

app_directory/
  gaesessions/
    __init__.py
  lib/
    httplib2/
      __init__.py
      other stuff
  app.yaml
  appengine_config.py
  index.yaml
  All other .py files/modules

For some reason I now get the following error:

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
Harshal Patil
  • 6,659
  • 8
  • 41
  • 57
Evan Layman
  • 3,691
  • 9
  • 31
  • 48

1 Answers1

1

I realized I had a circular import:

in File1.py

from File2 import class1

and in File2.py

from File1 import class3

I changed to: in File1.py

import File2

and in File2.py

import File1

and I moved all of my class imports from File1 and File2 further down the files and this solved my issue. Hopefully this helps someone else.

Evan Layman
  • 3,691
  • 9
  • 31
  • 48
  • 1
    Yes.. circular imports are evil and usually the error message are not going to tell you that :) – Lipis Mar 04 '13 at 10:39
  • So circular imports would still work on a local environment but not when deployed? – sam Feb 25 '20 at 19:58