Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'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?

like image 586
Anthony Kong Avatar asked Dec 19 '22 00:12

Anthony Kong


1 Answers

This worked for me, I installed the decorator package specifically for Python 3.4:

sudo python3.4 -m pip install decorator  # specifically Python 3.4
like image 63
Martien Lubberink Avatar answered Jan 17 '23 14:01

Martien Lubberink