Search code examples
pythongoogle-app-engine

'ImportError: No module named decorator' in google app engine


I have added a validators library to my google app engine by manually adding the code to a folder lib/validators. Then in my code I added this line

from validators.utils import ValidationFailure

When I run my app I got an exception from this line:

    from validators.utils import ValidationFailure
  File "lib/validators/__init__.py", line 1, in <module>
    from .between import between
  File "lib/validators/between.py", line 2, in <module>
    from .utils import validator
  File "lib/validators/utils.py", line 5, in <module>
    from decorator import decorator
ImportError: No module named decorator

If I run from decorator import decorator in the python intrepretor, it works as expected.

However when I tried it in the 'interactive console' in the local development server, I got the same error

enter image description here

How can I resolve this exception?


Solution

  • I need to copy the decorator.py and its dependency six.py into the same 'lib' folder.