Title: sys.executable equal to None in Jython standalone
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: transistor1, zyasoft
Priority: normal Keywords:

Created on 2014-06-06.20:16:43 by transistor1, last changed 2014-10-05.16:54:41 by zyasoft.

msg8598 (view) Author: Steve Russo (transistor1) Date: 2014-06-06.20:16:43
Using Jython 2.7b2, standalone.

Development using the popular Flask python module does not work properly in debug mode, because the underlying Werkzeug module uses sys.executable to determine how Python was launched.

Because sys.executable returns None in the standalone version, it causes Werkzeug's debug mode to crash.

For additional details, please see here:

and here:
msg8599 (view) Author: Jim Baker (zyasoft) Date: 2014-06-06.20:31:30
This issue has arisen periodically; see also, although I didn't see a bug here for this specific scenario.

One possibility is for org.python.util.jython.main to capture its args and pertinent environment variables (CLASSPATH), create a temporary wrapper executable (ideally binary, not script), and then execute that.

Possible wrappers include
msg9075 (view) Author: Jim Baker (zyasoft) Date: 2014-10-05.16:54:41
Users can ensure sys.executable is set with python.executable, but we can likely do a better job of trying to introspect the environment
Date User Action Args
2014-10-05 16:54:41zyasoftsetpriority: normal
messages: + msg9075
2014-06-06 20:31:31zyasoftsetnosy: + zyasoft
messages: + msg8599
2014-06-06 20:16:44transistor1create