Page 1 of 2

[SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is there

Posted: August 25th, 2020, 3:51 am
by pven
Since the upgrade to SABnzbd my scripts are not working anymore.

The error:
nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file or directory

But the file is there:
# ls -al /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py
-rwxrwxrwx 1 sc-sabnzbd sabnzbd 7872 Aug 24 15:29 /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py
#

In the previous version this worked (at least: I did not get errors). I also tried /volume1/@appstore as path, but wanted tot test it without the @-sign.

I have a simular issue for CharTranslator.py

What is going wrong?

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 25th, 2020, 10:11 am
by jcfp
pven wrote: August 25th, 2020, 3:51 amnice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file or directory
The No such file or directory part could also be referring to whatever is in the shebang line inside the script, for example an outdated or otherwise incorrect path to a python interpreter.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 25th, 2020, 10:13 am
by safihre
The chartranslator was removed from the Synology package because it was not python3 compatible.
Maybe the nice command is the problem. Could you try with nice disabled? (remove the nice parameters to disable it)

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 1:08 am
by pven
When disabling nice I get:
Exit(-1) Cannot run script /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py

When starting it manually it does not end in an error (immediately):
# python3 /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py
This script needs to be called from SABnzbd as post-processing script.
#

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 1:14 am
by sander
so (like jcfp said) ... what are the first lines of /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py ?

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 2:02 am
by safihre
The error "Cannot run script" is one thrown by SABnzbd. In the Debug logging it will specify the actual exception that was thrown. Could you check that?

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 3:43 am
by pven
The first lines. Is this sufficient?

Code: Select all

#!/usr/bin/python3 -OO
# Copyright 2007-2020 The SABnzbd-Team <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

"""

Deobfuscation post-processing script:

Will check in the completed job folder if maybe there are par2 files,
for example "rename.par2", and use those to rename the files.
If there is no "rename.par2" available, it will rename the largest
file to the job-name in the queue.
Can I mail the debug? I don't want to put it here.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 4:36 am
by safihre
Yes, [email protected]

You could try to remove the first line, then SABnzbd should default to just putting "python" in front of it.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 6:17 am
by pven
I mailed.

But ... when I remove the first line, it works as expected. Thats nice! :-)

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 26th, 2020, 7:13 am
by safihre
I checked and the Synology Python is located in:
/usr/local/python3

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 27th, 2020, 3:28 am
by pven
What is preferred: adding it to to first line, or just leave it out? Fow now it works.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 27th, 2020, 5:18 am
by safihre
Maybe should add a detection that checks if the part after the shebang even exists? What do you think Sander?

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 27th, 2020, 6:11 am
by sander
Yes, we can do that for scripts SAB tries to run (pre-queue, post-proc), if on POSIX.
If path-to-executable not correct ... clear warning / error message? Or overrule the shebang with by calling "/real/path/python3 <thescript.py>"? And discover /real/path/python3 by using the python-path that was used to start SABnzb itself?

We earlier discussed putting "#!/usr/bin/env python3 " as first line in scripts (the solution I like; let the OS handle it), but you (@saifhre) showed that that can cause other problems.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 27th, 2020, 1:21 pm
by jcfp
So my initial guess was right.

Best to leave it at /usr/bin/python3, which works in most cases. If the script comes as part of a package (don't have synology stuff around to try but the path /var/packages/sabnzbd/target/var/scripts/Deobfuscate.py does suggests so) and the system uses non-standard locations for interpreters, its maintainer should adjust any shebang lines accordingly.

Re: [SABnzbd3] nice: can't execute '/var/packages/sabnzbd/target/var/scripts/Deobfuscate.py': No such file,but file is t

Posted: August 27th, 2020, 4:03 pm
by safihre
Well, I am the maintainer of the Synology package.. So guess I have work to do 😅