Problem with Python user scripts under OS X
Posted: April 6th, 2010, 3:19 am
There is a problem with the fix for issue 309 (commit 3322).
The fix_python_script function which was added attempts to check for a python executable in the file’s shebang, and modify the command to run python manually using the -E switch (which suppresses the functionality of the PYTHON* variables mentioned in the ticket).
However, the regular expression that is used to parse the shebang is flawed, and in my script’s case results in python being executed with the empty string as the filename argument (and thus failing to run the user script).
The result is the following output in the completion e-mail from sab:
Stage Script
/usr/bin/python: can't find '__main__.py' in ''
I propose a different fix, which I have created a patch for.
This solution runs the child process with all PYTHON* variables removed from the environment, avoiding the issue without modifying the command being executed.
The fix_python_script function which was added attempts to check for a python executable in the file’s shebang, and modify the command to run python manually using the -E switch (which suppresses the functionality of the PYTHON* variables mentioned in the ticket).
However, the regular expression that is used to parse the shebang is flawed, and in my script’s case results in python being executed with the empty string as the filename argument (and thus failing to run the user script).
The result is the following output in the completion e-mail from sab:
Stage Script
/usr/bin/python: can't find '__main__.py' in ''
I propose a different fix, which I have created a patch for.
This solution runs the child process with all PYTHON* variables removed from the environment, avoiding the issue without modifying the command being executed.