Page 1 of 1

Problem with Python user scripts under OS X

Posted: April 6th, 2010, 3:19 am
by ciaran
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.

Re: Problem with Python user scripts under OS X

Posted: April 6th, 2010, 3:21 am
by shypike
We already implemented a solution for the next release.

Re: Problem with Python user scripts under OS X

Posted: April 6th, 2010, 3:26 am
by ciaran
Could you tell me the revision so I could test it with my script?

Re: Problem with Python user scripts under OS X

Posted: April 6th, 2010, 6:43 am
by ciaran
I can’t find a commit which fixes this, and the trunk seems to have the same problem.

Re: Problem with Python user scripts under OS X

Posted: April 6th, 2010, 8:10 am
by rAf
ciaran,

we don't use svn on assembla.com anymore, we have moved to launchpad.
https://bugs.launchpad.net/sabnzbd/+bug/554042
The fix is not merged in 0.5.x branch for now.