apport_python_hook.py sys.argv check broken for embedded Python interpreter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Apport |
Fix Released
|
Undecided
|
Unassigned | ||
apport (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In apport_
binary = os.path.
Ie., it assumes that sys.argv will always exist.
This will not be the case for where Python is being used embedded within a custom C application as normally it is the Python command line executable that would set up sys.argv but where Python is used in an embedded system setting up sys.argv never occurs.
That apport is assuming sys.argv doesn't exist will cause systems like mod_python and mod_wsgi to fail on startup. For example see:
http://
This will occur because even though mod_python and mod_wsgi setup a fake sys.argv to satisfy Python modules that may try and use it, the apport code is executed as part of the Python initialisation phase when the interpreter is first being initialised and thus before mod_python and mod_wsgi can fake up sys.argv.
Thus, you should change your code to check if sys.argv exists.
I can confirm this fails with (some newer versions of) crystal space game engine.