Page 1 of 1

NzbToMedia -> Python3

Posted: January 1st, 2020, 7:59 am
by PeterPan669
Happy new year 8)

Starting today, Python 2.7 is no longer officially supported. NzbToMedia postprocessing fails to run, if not using Python 3.
I tried to call the script via .sh to use Python3, but it seems that Sab forces Python 2.7 nonetheless.

What are our options? Is there a way to force Sab to run those scripts under Python 3+? I understand Sab is not (yet) supporting Python3. Or should we go at it differently?

Many thanks for your hard work Saph!

Re: NzbToMedia -> Python3

Posted: January 1st, 2020, 11:51 am
by Sarcas
Struggling with the same problem.

As a new user i am not allowed to post links, but also see issue 1533 at github from Clinton Hall's nzbToMedia scripts.

thx

EDIT by sander: https://github.com/clinton-hall/nzbToMedia/issues/1533

Re: NzbToMedia -> Python3

Posted: January 1st, 2020, 12:27 pm
by PeterPan669
To add / clarify;
The workaround is proposed as to create a .sh file, and let SabNZBD run that as the script.
The contents would be:
#!/bin/bash
python3 /volume1/downloads/SCRIPTS/nzbToSickBeard.py "$@"

Now, from the CLI, this works. From SabNZBD however, we still get "Python 2.7 is no longer supported.", which means SabNZBD tries to run the file under Python2.7 still. Clinton Hall suggested that he had seen in the past that SabNZBD forces .py files to run under the same version of Python as SabNZBD runs under, hence my question: Can we overrule this behavior?

Thanks!

EDIT: I think my error was that I was pressing 'retry' on previous failed items, which seem to call the old script as well. I am testing now with a new API call from medusa to see if it works now. Let's consider this fixed with the .sh file, and if not, i'll post back :) thanks!

Re: NzbToMedia -> Python3

Posted: January 1st, 2020, 2:21 pm
by sander
PeterPan669 wrote: January 1st, 2020, 7:59 am I tried to call the script via .sh to use Python3, but it seems that Sab forces Python 2.7 nonetheless.
If true, that is interesting (and annoying).


EDIT: I verified with SABnzbd 2.3.9 (thus running python2), and let SAB run a python3 post-processing script, and that worked perfectly: python3. So I cannot confirm your statement.



More
PeterPan669 wrote: January 1st, 2020, 7:59 am I understand Sab is not (yet) supporting Python3.
On Linux, the current python3 version of SABnzbd is quite usable; I've been using it for months now for my downloads.
So ... do you want to use that?

Re: NzbToMedia -> Python3

Posted: January 1st, 2020, 3:57 pm
by PeterPan669
Hello Sander,

Thank you for commenting :)

I wasn't aware of a Python3 version of SabNZBD. I'm on Synology, so probably I didn't look for it in the right place.
At any rate, I managed to resolve the issue; It was my misunderstanding on how Sab works. Instead of testing with a 'fresh' API call from Medusa, I pressed "Retry" after altering the script. I didn't know that the old script would still be attached that way. With the new downloads, all is working great.

To recap; the solution for me was creating a new .sh file, that is called by Sab as a post processing. Inside the .sh file, I specified:
#!/bin/bash
python3 /volume1/downloads/SCRIPTS/nzbToSickBeard.py "$@"

I hope this helps others!
Thanks again for all you guys hard work!

Re: NzbToMedia -> Python3

Posted: January 1st, 2020, 4:37 pm
by sander
Ah, Synology ... no that is not a great platform to test-use python3-sabnzbd.

Re: NzbToMedia -> Python3

Posted: January 2nd, 2020, 1:09 pm
by ikkeenjij36
I also like to report same issue,and also got it resolved now by editing eol.py file for now
Just waiting for an update of the synology package of sabnzbd for use of python 3

Re: NzbToMedia -> Python3

Posted: January 2nd, 2020, 2:30 pm
by sander
ikkeenjij36 wrote: January 2nd, 2020, 1:09 pm I also like to report same issue,and also got it resolved now by editing eol.py file for now
Clever decision.

BTW: On which OS is your SABnzbd running?

Re: NzbToMedia -> Python3

Posted: January 2nd, 2020, 4:12 pm
by sander
Peter, can you do this:

Of /volume1/downloads/SCRIPTS/nzbToSickBeard.py change the first line

Code: Select all

#!/usr/bin/env python
to

Code: Select all

#!/usr/bin/env python3
(So: just add a 3 directly after python, without a space)

and start using the nzbToSickBeard.py directly again. Please report back the result.

Re: NzbToMedia -> Python3

Posted: January 2nd, 2020, 4:36 pm
by OneCD
@sander, I did that a couple of days ago, and can verify it works fine. :)

Re: NzbToMedia -> Python3

Posted: January 2nd, 2020, 4:42 pm
by sander
OneCD wrote: January 2nd, 2020, 4:36 pm @sander, I did that a couple of days ago, and can verify it works fine. :)
Cool.

EDIT: question: just that one python file, or more nzbtomedia python files?

Re: NzbToMedia -> Python3

Posted: January 3rd, 2020, 9:49 am
by ikkeenjij36
sander wrote: January 2nd, 2020, 2:30 pm
ikkeenjij36 wrote: January 2nd, 2020, 1:09 pm I also like to report same issue,and also got it resolved now by editing eol.py file for now
Clever decision.

BTW: On which OS is your SABnzbd running?
Running on synology dsm6.1

Re: NzbToMedia -> Python3

Posted: January 3rd, 2020, 1:37 pm
by OneCD
sander wrote: January 2nd, 2020, 4:42 pm EDIT: question: just that one python file, or more nzbtomedia python files?
I did the same mod to a couple of other nzbToMedia post-processing Python files (called via SABnzbd). But not all nzbToMedia Python files.

Clinton Hall probably needs to update nzbToMedia to request 'python3' instead of 'python'.

Re: NzbToMedia -> Python3

Posted: January 6th, 2020, 9:30 pm
by RumpSauce
I was getting Python 2.7 is no longer supported. I did the edit mentioned for nzbToSickBeardpy but now I am getting ModuleNotFoundError: No module named '_sqlite3'

Re: NzbToMedia -> Python3

Posted: January 7th, 2020, 8:05 am
by Sarcas
The dev has changed to code so the script now only warns about the old python version, but continuos to work. I had to do a git pull to get this new version, but now everything works again the way it used to work.