caronc / nzb-notify

Push Notifications to a large number of supported services for NZBGet and SABnzbd (based on Apprise)
GNU General Public License v3.0
129 stars 15 forks source link

Error when running script on Windows 'no such file or directory' #87

Open Croman12 opened 2 years ago

Croman12 commented 2 years ago

:question: Question

I'm trying to set it up on my Windows pc, but I seem to have problems getting the script to run.

I installed the script in the directory (the .py file and the Notify folder), when I put in my servers, I get this error message. For sure it must be easy to fix, but I have zero experience with Python and have no idea where to start.

I found on the internet that maybe the directories for Python are different, but I think I can see in the log that it is not the problem. I changed the NZBGet server running as System and running as my personal account, but that didn't seem to work. When I run the .py file in IDLE, I get the "nzbget module missing', that may be because I'm running it in NZBGet (or is this also not intended?).

This is the error message:

<Executing script Notify.py with command TestServers Notify: C:\Program Files\Python39\python.exe: can't open file 'C:\Windows\system32\L': [Errno 2] No such file or directory Script Notify.py with command TestServers failed (terminated with unknown status)

Any help is greatly appreciated.

Croman12 commented 2 years ago

Okay so a lot of progress since yesterday. When I manually run the file with the parameter for telegram, I receive a test message on Telegram. There was an error though, and I'm not sure what it means:

`Warning (from warnings module): File "C:\Users\NAME\AppData\Roaming\Python\Python39\site-packages\apprise\utils.py", line 704 pmatch = re.search( FutureWarning: Possible nested set at position 12 2022-04-27 00:19:32,082 - 2084 - INFO - Notifying 1 service(s) asynchronously. 2022-04-27 00:19:32,246 - 2084 - INFO - Sent Telegram notification.

`

In NZBGet I still cannot run is and I get the same error message as before, it has to be something with the quotation marks or with how NZBGet is running the script. I run NZBGet as a service as my local Administrator account.

I'm thinking about reinstalling Python on a C:\Python path and hoping it solves the problem, but I'm afraid that I break other scripts that rely on Python.

Again, any help is greatly appreciated, especially since I feel I'm really close now.

EDIT: So I pretty much reinstalled NZBGet and Python. The script works now when I'm running it via Python myself and I receive the test message. The problem is that in NZBGet, I still get this error message:

Executing script Notify.py with command TestServers Notify: C:\Python310\python.exe: can't open file 'C:\Windows\system32\L': [Errno 2] No such file or directory Script Notify.py with command TestServers failed (terminated with unknown status)

caronc commented 2 years ago

Seems like you may not have the Notify.py script in the correct directory. Also reload NZBGet so it can see it (once you've placed it).

You will be able to run tests right from in NZBGet once this is all in place.

If you can run from the command line then you're halfway there for sure. NZBGet needs to be able to access your python.exe file on your PC. Make sure it's in the path and/or configured in NZBGet.

Croman12 commented 2 years ago

I finally did it. I don't know why, because everything in environment is not directing at all to the system32 folder, but apparently something is still looking for it. I put ".py=C:\Python310\python.exe" in shell override option in nzbget, and everything is working now. Thank you for your help and response!

One quick question, when a download finishes, all the script sends is a picture or should there also be some text in the message?

caronc commented 2 years ago

Yes, you should receive text as well. What notification service are you using? In NZBGet you can also send a test notification to make sure it's all hooked up properly.

Croman12 commented 2 years ago

I use Telegram. When a download starts, I get a notification saying "New file queued for download "NZB". But when the download is finished, I only get the succes image (apprise-success-128x128.png).

EDIT: I checked the logs in NZBGET, this is what I get when a nb if queued:

info | Wed Apr 27 2022 15:24:41 | Notify: Sent Telegram notification. -- | -- | -- info | Wed Apr 27 2022 15:24:41 | Notify: Notifying 1 service(s) asynchronously. info | Wed Apr 27 2022 15:24:41 | Notify: pmatch = re.search( info | Wed Apr 27 2022 15:24:41 | Notify: C:\Python310\lib\site-packages\apprise\utils.py:704: FutureWarning: Possible nested set at position 12

This is when the download is finished:

info | Wed Apr 27 2022 15:28:37 | Post-process-script Notify.py for FILENAME successful -- | -- | -- warning | Wed Apr 27 2022 15:28:37 | Notify: Failed to send Telegram notification to -CHATID: Bad Request: can't parse entities: Unsupported start tag "ul" at byte offset 143, error=400. info | Wed Apr 27 2022 15:28:36 | Notify: Notifying 1 service(s) asynchronously. info | Wed Apr 27 2022 15:28:36 | Notify: pmatch = re.search( info | Wed Apr 27 2022 15:28:36 | Notify: C:\Python310\lib\site-packages\apprise\utils.py:704: FutureWarning: Possible nested set at position 12 info | Wed Apr 27 2022 15:28:36 | Notify: NZBParse - NZB-File parsed 2 meta entries info | Wed Apr 27 2022 15:28:36 | Notify: NZB-File detected: FILENAME.nzb.queued

And what I receive is this (there is nothing missing at the bottom, this is everything):

https://imgur.com/a/Z4b4pPj

caronc commented 2 years ago

I did a mini-release of Apprise to fix this here. I believe we're good.

pip install -u apprise and try again.

Croman12 commented 2 years ago

So I tried what u suggested, i updated apprise (version is now 0.9.8.3). I downloaded a file and all I get on succesful download is still the picture. But the log in NZBGet changed, this is how it looks like now:

info | Fri Apr 29 2022 18:44:46 | Post-process-script Notify.py for FILENAME successful -- | -- | -- warning | Fri Apr 29 2022 18:44:46 | Notify: Failed to send Telegram notification to -CHATID: Bad Request: can't parse entities: Unsupported start tag "ul" at byte offset 143, error=400. info | Fri Apr 29 2022 18:44:46 | Notify: Notifying 1 service(s) asynchronously. info | Fri Apr 29 2022 18:44:46 | Notify: NZBParse - NZB-File parsed 0 meta entries info | Fri Apr 29 2022 18:44:46 | Notify: NZB-File detected: FILENAME.nzb.queued info | Fri Apr 29 2022 18:44:44 | Executing post-process-script Notify.py for FILENAME