[Solved] NZBGet, Windows10, and Python3

Get help, report and discuss bugs.
Post Reply
PSA9
Posts: 7
Joined: 12 May 2015, 16:07

[Solved] NZBGet, Windows10, and Python3

Post by PSA9 » 16 Jan 2021, 22:18

I converted my linux shell script to python about a year ago. It works with NZBGet or stand alone from command line. It works perfect on Linux and now trying to get it to also work on Windows version of NZBGet. My OS is Windows 10. I installed python 3.9 from the Microsoft store and nzbget-21.0-bin-windows-setup.

From command prompt or power shell works exactly same way as it does on linux. The problem is from NZBGet on windows 10. for nzbget testing purposes i am using a simple hello world script. When i execute the script it opens the file in notepad++ but does not execute the code.

Do i need to use shell overide or different shebang?
How can i make nzbget compatible with python from the microsoft store?

Code: Select all

#!/usr/bin/python

################################################################################
### NZBGET POST-PROCESSING SCRIPT                                            ###

# Testing Script.
#
# Hello World.
#
# NOTE: Just a Testing Script.

################################################################################
### OPTIONS                                                                  ###

# Test without POST-PROCESSING.
#TestButton@TestButton


### NZBGET POST-PROCESSING SCRIPT                                            ###
################################################################################

import os, sys

if os.environ.get('NZBCP_COMMAND') == 'TestButton':
    print('Hello, world!')
    sys.exit(93)
Last edited by PSA9 on 24 Jan 2021, 21:28, edited 3 times in total.


PSA9
Posts: 7
Joined: 12 May 2015, 16:07

Re: NZBGet, Windows10, and Python3

Post by PSA9 » 24 Jan 2021, 20:31

sanderj thanks for the help. I tried everything suggested with no success.
I figured it out on my own by using Shell Override from EXTENSION SCRIPTS in NZBGet.

.py=C:\Users\PSA9\AppData\Local\Microsoft\WindowsApps\python.exe

Changing PSA9 to your username should work, but if not I have updated the code to find location from command prompt or power shell.

Code: Select all

#!/usr/bin/python

################################################################################
### NZBGET POST-PROCESSING SCRIPT                                            ###

# Testing Script.
#
# Hello World.
#
# NOTE: Just a Testing Script.

################################################################################
### OPTIONS                                                                  ###

# Test without POST-PROCESSING.
#TestButton@TestButton


### NZBGET POST-PROCESSING SCRIPT                                            ###
################################################################################

import os, sys

if os.environ.get('NZBCP_COMMAND') == 'TestButton':
    print('Hello, world!')
    print(os.path.dirname(sys.executable))
    sys.exit(93)

print(os.path.dirname(sys.executable))

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests