-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module import fails when auto_reload is active #1492
Comments
What does your |
Completely empty. I updated my Sanic recently from 0.8 to 18.x along with my Python 3.6 to 3.7 or something, and somehow this issue appeared. |
How does your project hierarchy look like ? |
I just run from |
I don't think your python interpreter know your init0 module unless you've appended that to your sys.path |
@yunstanford Hmm, but it works okay when it's not in debug mode, though. |
ok, i think it's sth. wrong with the auto_reload logic.. You can set ( |
Yeap, by setting it to
the error no longer occurs. |
I hit the same error, adding workers >1 works for me as well! |
@huge-success/sanic-core-devs Anyone want to take a whack at this? |
|
To be clear, this issue is not because of windows. When invoking python interpreter with However, The reload_logic use https://github.com/huge-success/sanic/blob/master/sanic/reloader_helpers.py#L36-L57 to start worker process. That command line will look like The reload implementation is not robust (and buggy), as mentioned before. |
I've written a basic workaround that fixes the issue described in this thread. #1501 This is a simple change to get bugs fixed in the current auto_reloader for the 2019.03 sanic release. |
I have two piece of code (the structure has been simplified for clarity sake)
First in base.py
Second in run_test.py
If I were to run
python -m init0.run_test
withdebug = False
then everything works perfectly, however if it'sdebug = True
, then it'd throw meModuleNotFoundError: No module named 'init0'
Is it some sort of loading error somewhere that I need to configure beforehand?
Thanks a lot in advance
The text was updated successfully, but these errors were encountered: