NzbToMedia -> Python3

Get help with all aspects of 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
PeterPan669
Newbie
Newbie
Posts: 6
Joined: December 29th, 2019, 7:42 am

NzbToMedia -> Python3

Post 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!
Sarcas
Newbie
Newbie
Posts: 5
Joined: January 1st, 2020, 11:45 am

Re: NzbToMedia -> Python3

Post 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
PeterPan669
Newbie
Newbie
Posts: 6
Joined: December 29th, 2019, 7:42 am

Re: NzbToMedia -> Python3

Post 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!
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: NzbToMedia -> Python3

Post 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?
PeterPan669
Newbie
Newbie
Posts: 6
Joined: December 29th, 2019, 7:42 am

Re: NzbToMedia -> Python3

Post 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!
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: NzbToMedia -> Python3

Post by sander »

Ah, Synology ... no that is not a great platform to test-use python3-sabnzbd.
ikkeenjij36
Newbie
Newbie
Posts: 30
Joined: July 17th, 2012, 6:00 pm

Re: NzbToMedia -> Python3

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: NzbToMedia -> Python3

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: NzbToMedia -> Python3

Post 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.
User avatar
OneCD
Hero Member
Hero Member
Posts: 557
Joined: March 4th, 2017, 3:47 pm

Re: NzbToMedia -> Python3

Post by OneCD »

@sander, I did that a couple of days ago, and can verify it works fine. :)
Stuff I like: Apache bash cron DD-WRT Debian DNSMasq Entware FireFox GitHub ImageMagick Kate KDE LibreELEC Netrunner NFS NVIDIA OpenVPN Orvibo-S20 pfSense Python Raspberry-Pi RAID SABnzbd Transmission Usenet VirtualBox Watcher3 XFCE
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: NzbToMedia -> Python3

Post 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?
ikkeenjij36
Newbie
Newbie
Posts: 30
Joined: July 17th, 2012, 6:00 pm

Re: NzbToMedia -> Python3

Post 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
User avatar
OneCD
Hero Member
Hero Member
Posts: 557
Joined: March 4th, 2017, 3:47 pm

Re: NzbToMedia -> Python3

Post 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'.
Stuff I like: Apache bash cron DD-WRT Debian DNSMasq Entware FireFox GitHub ImageMagick Kate KDE LibreELEC Netrunner NFS NVIDIA OpenVPN Orvibo-S20 pfSense Python Raspberry-Pi RAID SABnzbd Transmission Usenet VirtualBox Watcher3 XFCE
RumpSauce
Newbie
Newbie
Posts: 1
Joined: January 6th, 2020, 9:27 pm

Re: NzbToMedia -> Python3

Post 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'
Sarcas
Newbie
Newbie
Posts: 5
Joined: January 1st, 2020, 11:45 am

Re: NzbToMedia -> Python3

Post 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.
Post Reply