Issue 36196: sys.executable does not return python3 executable when using uwsgi (original) (raw)
Issue36196
Created on 2019-03-05 14:31 by Joris VAN HOUTVEN, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Messages (4) | ||
---|---|---|
msg337190 - (view) | Author: Joris VAN HOUTVEN (Joris VAN HOUTVEN) | Date: 2019-03-05 14:31 |
when serving a Flask app with uwsgi, using `sys.executable` will provide you the path to your uwsgi executable, not your python executable. However, the docs specify that it should always return the python interpreter: https://docs.python.org/3/library/sys.html#sys.executable | ||
msg337209 - (view) | Author: Karthikeyan Singaravelan (xtreak) * ![]() |
Date: 2019-03-05 15:33 |
related uwsgi issue : https://github.com/unbit/uwsgi/issues/670 | ||
msg337215 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2019-03-05 15:58 |
I don't think this is a documentation bug. They insert "uwsgi" to "sys.executable" manually. https://github.com/unbit/uwsgi/blob/3149df02ed443131c54ea6afb29fcbb0ed4d1139/plugins/python/pyutils.c#L398-402 #ifdef PYTHREE PyDict_SetItemString(sys_dict, "executable", PyUnicode_FromString(uwsgi.binary_path)); #else PyDict_SetItemString(sys_dict, "executable", PyString_FromString(uwsgi.binary_path)); #endif | ||
msg337286 - (view) | Author: Joris VAN HOUTVEN (Joris VAN HOUTVEN) | Date: 2019-03-06 09:47 |
OK, so it is indeed uwsgi interfering with the sys.executable value. In the github pst Inada Naoki refers to: "uwsgi is your current python interpreter, as it links the libpython.so. Getting sys.executable is not possibile as there is no binary path hard-encoded in library by itself" So I suppose this issue can be closed here. I will comment on the uwsgi github. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:12 | admin | set | github: 80377 |
2019-03-06 10:02:51 | methane | set | resolution: fixed -> not a bug |
2019-03-06 10:02:42 | methane | set | status: open -> closedresolution: fixedstage: resolved |
2019-03-06 09:47:28 | Joris VAN HOUTVEN | set | messages: + |
2019-03-05 15:58:02 | methane | set | nosy: + methanemessages: + |
2019-03-05 15:33:58 | xtreak | set | nosy: + xtreakmessages: + |
2019-03-05 14:31:26 | Joris VAN HOUTVEN | create |