Problem running a python script for postproc

Get help with all aspects of SABnzbd

Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 6:28 am

So, I searched my butt off, and didn't find an answer. Forgive me if I missed something.

I've got the python script provided in another thread for updating XBMC and sending an alert via Prowl. I don't have the link to the other thread off-hand. I'll track it down tomorrow.

Anyway, when I try selecting the script itself as my postproc script, I get the following error message:

Script
    Exit(1) operable program or batch file. (More)

More:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.



I have Python 2.6.4 installed. I have added C:\python26 to Windows' path.

I thought I'd try calling it from a batch file. I made a batch file with the following contents:

Code: Select all
python XBMCUpdate.py %1 %2 %3 %4 %5 %6


and got

C:\Program Files (x86)\SABnzbd>python XBMCUpdate.py "E:\Movies\The Osbournes\Season 4" "The Osbournes - 4x05 - 28 Days Later" "The Osbournes - 4x05 - 28 Days Later" 5259414 movies alt.binaries.multimedia.comedy
'python' is not recognized as an internal or external command,
operable program or batch file.


So I tried removing "python" from the bat file, and got:

C:\Program Files (x86)\SABnzbd>XBMCUpdate.py "E:\Movies\The Osbournes\Season 4" "The Osbournes - 4x05 - 28 Days Later" "The Osbournes - 4x05 - 28 Days Later" 5259414 movies alt.binaries.multimedia.comedy
'XBMCUpdate.py' is not recognized as an internal or external command,
operable program or batch file.




Soooo, I gots no clue. I can run the .py file or .bat file from the command line, no problem.

Actually, clue: I haven't rebooted since installing python or adding it to the windows path. Should that matter? I'll give it a try when I wake up. Bed now.

Thanks for any help!

Oh, running SABnzbd+ 0.5.0b5
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 6:53 am

Obviously Python should be in the Windows system path.
Otherwise you should use the full path, like
"c:\program files\Python\python.exe"

Also, the current directory is not the script folder!
If you use a wrapper it should be something like this.
"c:\program files\Python\python.exe" "c:\my\script\path\doit.py"

I think that after a reboot you should be able to run without a wrapper.
I'll check that remark for correctness later.
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 11:19 am

Thanks for the reply.

Python is in the windows path. I'll reboot in a bit and give it a try. Should I need to call "python.exe scriptname.py" via a batch file? Is there a reason I can't just call the script directly when I can from the command line?

Thanks, again!
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 12:34 pm

Only when you are able to run a PY file directly from the command line
it will work from SABnzbd also.
That's just the OS being critical.
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 1:15 pm

Hmmm... Well, I *can* run it from the command line directly, but when I try in sab, I get this error that I mentioned in the first post:

Script
    Exit(1) operable program or batch file. (More)

More:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 1:46 pm

OK, you'll need the wrapper then.
I'm still not sure why it goes wrong, i'll check that later.
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 2:30 pm

Rebooted. Still getting this when I try running the python script directly:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.


Weird that it works fine from the command line, but not SAB.

I did manage to get it working with the following wrapper, like you suggested:

"c:\python26\python.exe" "C:\Program Files (x86)\SABnzbd\scripts\XBMCUpdate.py" %1 %2 %3 %4 %5 %6


If you come up with an idea as to why I can't point at the .py directly, let me know, and I'll test/fix what needs testing/fixing.

Thanks for your help!
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 2:57 pm

There must be something wrong with your Python installation.
I have no problems running a test.py script from SABnzbd.
Did you use the Python installer?
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 3:21 pm

shypike wrote:There must be something wrong with your Python installation.
I have no problems running a test.py script from SABnzbd.
Did you use the Python installer?



I did, indeed. Default settings, even.

Any tips on what I can try to troubleshoot?

The fact that it's saying "'C:\Program' is not recognized..." sounds like it's having a problem with the space in the path to the scripts folder, but .bat files work just fine.
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 4:06 pm

Could indeed be the spaces in the path, I install Python in c:\bin\python.
I vaguely remember that Python isn't completely "space in path" compatible.
The trick is usually to put this in the path instead:
c:\progra~1\python26

(Note that you need c:\progra~2\python on 64 bit versions of Windows.)
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 8th, 2010, 6:20 pm

Weird part is, I've got python installed in C:\python26

SABnzbd is in program files, as is my scripts folder, so maybe I need to move that (or change the way it's specified in the sabnzbd settings, maybe?)
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 8th, 2010, 6:26 pm

It should not be necessary, but it's worth a try.
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby rudyb » January 9th, 2010, 6:13 am

Changed my scripts folder location in sab's settings to "c:\progra~2\sabnzbd\scripts". I can now point sabnzbd directly at python scripts.

Bug?

Running Windows 7, SABnzbd+ 0.5.0 b5. Python 2.6.4, default installation, installed to c:\python26

If you think it's a sab bug, and need anything to help track it down, please let me know, and I'll be happy to assist. 
rudyb
Newbie
Newbie
 
Posts: 28
Joined: December 9th, 2009, 12:46 am

Re: Problem running a python script for postproc

Postby shypike » January 9th, 2010, 9:50 am

OK, got a clue now where to look.
Thanks.
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Re: Problem running a python script for postproc

Postby shypike » January 9th, 2010, 11:35 am

It's caused by a bug in Python's system library (Python is the programming language we use).
I found a work-around. Will be fixed in next release (after Beta6).
User avatar
shypike
Administrator
Administrator
 
Posts: 16579
Joined: January 18th, 2008, 1:49 pm

Next

Return to General Help