Open kyeljmd opened 6 years ago
Does the usecase
folder have an __init__.py
?
@ablakey Yes, all of the subfolders have __init__.py
[Edit: fixed markdown blunder -@scoates]
Any leads on this? I am facing the same problem in one of my projects
facing same issue in my project after deployed on AWS. note that the zipped file is bigger than 60M
Same issue as above. Unable to import module 'handler': attempted relative import with no known parent package
try installing flask and all other dependencies using pip in your virtual environment where you are running zappa
Try renaming your virtualenv, it solved the issue for me. The problem was, that the name of virtualenv and the name of the app were the same.
See this a few times. This is almost certainly because zappa or flask (likely zappa) is not in your virtualenv.
pip freeze > requirements.txt
Make sure all of the dependencies you expect are showing up in the requirements.txt.
Flask and zappa are both installed in my virtualenv, and the name of my virtualenv is different than my app. Still get this error.
I'm having a similar issue. Any leads on this would be great.
At the top of your file, you can put this code.
__name__ = '.'.join(__name__.split('/'))
__package__ = '.'.join('.'.join(__name__.split('/')).split('.')[:-1])
Use
Flask==1.0.3 Flask-Mail==0.9.1 Flask-WTF==0.14.2 zappa==0.48.2
The above versions solved my problem.
I got the same error. "Unable to import module 'handler': attempted relative import with no known parent package" Any assistance would be very much appreciated
It's happening for me too.
I am developing a flask app locally, and I am using relative imports for my app. Here's my directory structure.
here's my app.py
And here's my directory structure.
Directory Structure
Everything is running welll locally, however upon deploying it to AWS using zappa. produces this cloudwatch error.
attempted relative import with no known parent package: ImportError Traceback (most recent call last): File "/var/task/handler.py", line 509, in lambda_handler return LambdaHandler.lambda_handler(event, context) File "/var/task/handler.py", line 237, in lambda_handler handler = cls() File "/var/task/handler.py", line 129, in __init__ self.app_module = importlib.import_module(self.settings.APP_MODULE) File "/var/lang/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/var/task/app.py", line 4, in <module> from .dataproviders import provider ImportError: attempted relative import with no known parent package
I am currently working on virtualenvwrapper in windows