Page 1 of 1

Post-process script failing to launch

Posted: November 24th, 2013, 6:05 am
by AutomaticCoding
So, like everyone else, I run Sab with Sickbeard, and, unfortunately, I have Python3 & Python2 installed. If I tell Sab to use "sabToSickBeard.py", it defaults for Python3 (Which is what I want), however, that causes syntax errors. So, I thought, "Well, that's easy to change, I just have to create a small bash script to run the python script with python2":-

Code: Select all

/usr/bin/python2 sabToSickBeard.py "$@"
However, that errors out with:-

Code: Select all

Exit(-1) Cannot run script /mnt/ssd/PostProcessing/sabToSickBeard.sh (More)
SABnzbd is running as a specific user for the daemon, 'sabnzbd', and, I can manually execute the bash script fine as that user:-

Code: Select all

[sabnzbd@ServerUK PostProcessing]$ /mnt/ssd/PostProcessing/sabToSickBeard.sh
No folder supplied - is this being called from SABnzbd?
So, I know I could convert the whole post process script to python3, or, change my default python application from python3 to python2, but, both of those are a pain. Can someone tell me why my bash script fails to run in SABnzbd, and, not with bash?

Thanks,
Automatic.

P.S. Because I know someone will ask:-
File permissions:-

Code: Select all

[sabnzbd@ServerUK PostProcessing]$ ls -lsa
total 28
4 drwxr-x--- 2 sabnzbd daemons 4096 Nov 24 11:01 .
4 drwxr-xr-x 7 root    root    4096 Nov 24 09:17 ..
4 -rwxr----- 1 sabnzbd daemons  105 Nov 24 09:18 autoProcessTV.cfg
4 -rwxr----- 1 sabnzbd daemons 3134 Nov 20 21:23 autoProcessTV.py
4 -rwxr----- 1 sabnzbd daemons 2825 Nov 24 09:47 autoProcessTV.pyc
4 -rwxr----- 1 sabnzbd daemons 1049 Nov 24 11:01 sabToSickBeard.py
4 -rwxr----- 1 sabnzbd daemons   40 Nov 24 10:52 sabToSickBeard.sh
Process list:-

Code: Select all

sabnzbd   3967  9.4  0.8 2979184 67516 ?       Sl   10:02   5:54 python2 /mnt/ssd/SABnzbd/SABnzbd.py -d --config-file /mnt/ssd/SABnzbd/SABnzbd.ini
EDIT:- Uh-oh, I may be stupid, just realized I was using a relative path in the bash script for the Python file. Testing this out, hopefully I didn't just publicly post my idiocy.
EDIT2: Same issue with this script:-

Code: Select all

/usr/bin/python2 "/mnt/ssd/PostProcessing/sabToSickBeard.py" "$@"

Re: Post-process script failing to launch

Posted: November 24th, 2013, 7:58 am
by sander
A typical .py script starts with the director which python to use, like:

#!/usr/bin/python -OO

So ... I would change that first line of the python script to the python version you want to use.

HTH

Re: Post-process script failing to launch

Posted: November 24th, 2013, 9:41 am
by AutomaticCoding
sander wrote:A typical .py script starts with the director which python to use, like:

#!/usr/bin/python -OO

So ... I would change that first line of the python script to the python version you want to use.

HTH
Yeah, changing the shebang fixed it, surprised I didn't think of that.

Thanks, works fine now.