You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objections against just doing just that, on Python versions where we can? Even if we cannot do that for some reason, I would still add a warning when launching with clearly unintended sys.path - it is a common source of confusion.
The text was updated successfully, but these errors were encountered:
python -m gunicorn my:app is already the simplest and most obvious example. Add print(sys.path, sys.argv, sys.orig_argv) calls to your (cPython 3.10+) app if you want to see it in action.
Mixing sys.executable and parsed argv produces unintentional sys.path changes on re-exec:
gunicorn my:app
(withargv[0] == '[..]/gunicorn'
)argv[0]
is significant, such aspython3 -m gunicorn my:app
[..]/__main__.py
sys.path
listing directory containing__main__.py
werkzeug
(such asflask
) will crash because we clobbered thehttp
namegunicorn/gunicorn/arbiter.py
Lines 68 to 76 in 903792f
(Side note: The
p
is wrong and scaring static analyzers, but harmless in cPython. I suggest cleaning it up while we are at it.)gunicorn/gunicorn/arbiter.py
Lines 430 to 431 in 903792f
I think we just did not have the option to use the original arguments (added in 3.10):
Objections against just doing just that, on Python versions where we can? Even if we cannot do that for some reason, I would still add a warning when launching with clearly unintended
sys.path
- it is a common source of confusion.The text was updated successfully, but these errors were encountered: