Problem with Python user scripts under OS X

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
ciaran
Newbie
Newbie
Posts: 3
Joined: April 6th, 2010, 2:40 am

Problem with Python user scripts under OS X

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Problem with Python user scripts under OS X

Post by shypike »

We already implemented a solution for the next release.
ciaran
Newbie
Newbie
Posts: 3
Joined: April 6th, 2010, 2:40 am

Re: Problem with Python user scripts under OS X

Post by ciaran »

Could you tell me the revision so I could test it with my script?
ciaran
Newbie
Newbie
Posts: 3
Joined: April 6th, 2010, 2:40 am

Re: Problem with Python user scripts under OS X

Post by ciaran »

I can’t find a commit which fixes this, and the trunk seems to have the same problem.
rAf
Moderator
Moderator
Posts: 546
Joined: April 28th, 2008, 2:35 pm
Location: France
Contact:

Re: Problem with Python user scripts under OS X

Post 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.
Last edited by shypike on April 6th, 2010, 9:45 am, edited 1 time in total.
Post Reply