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

Telegram not working #42

Closed kilgil27 closed 6 years ago

kilgil27 commented 6 years ago

I am trying to setup the Telegram notifications in SABnzbd. However, whenever I try to test the notification, I get the following error:

Notification script returned exit code 1 and output "'"python"' is not recognized as an internal or external command, operable program or batch file."

I've added python to the path in windows, I am able to access it through the command line, but every time I try to test it through SAB, it fails. Any ideas?

caronc commented 6 years ago

Are you calling the script directly or are these errors showing up in your SABnzbd logs?

A couple of other questions too:

  1. What version of SABnzbd are you using?
  2. What operating system are you using?

You could check out this blog entry which has a section on how to configure notifications that might help.

kilgil27 commented 6 years ago

I am just doing the test notification through SABnzbd (version 2.3.4RC1). This is on Windows 10

caronc commented 6 years ago

See this stackoverflow question. Your issue appears to be tied to your installation of Python.

Make sure first of all that Python is installed (v2.7.x). I presume you're past this because i don't think SABnzbd would work anyway. Secondly, (and with respect to the stackoverflow reference) make sure your python binary is in your path.

kilgil27 commented 6 years ago

yes, SAB shows python 2.7.15 is installed. Python is in my path. I am able to invoke it through the command prompt, and can attempt to run the script from the command prompt, but I get a syntax error when trying to run it, but that's another issue lol. It seems to be SABnzbd itself that's having trouble running python.

caronc commented 6 years ago

I am able to invoke it through the command prompt, and can attempt to run the script from the command prompt, but I get a syntax error when trying to run it, but that's another issue

We should probably try to fix this problem first because it's one i'm more familiar with. Perhaps you could provide me with the error message you're getting?

As per the first/original issue: here is another article on your symptoms but it still seems to be an issue with the environment not being set properly (from SABnzbd's point of view). Windows isn't my strong suit here unfortunately. Maybe @Safihre will have a suggestion? He's an incredible resource for topics like this. :wink:

Safihre commented 6 years ago

@kilgil27 When installing Python, did you select the "Add to path" option in the installer? This is the one you need. Also make sure you have Python 2.7.x (not 3.x), because python.org doesn't even show the 2.7-series anymore on their main-page. You have to actively search for it. The Python that SABnzbd shows in the Config is it's internal Python, it's included in SAB but not available for scripts etc.

kilgil27 commented 6 years ago

@Safihre I re-installed Python to make sure (2.7.15) and checked add to path option, instead of adding it manually, but still no luck. I am able to go into command prompt and type python, and it shows as installed and running

@caronc How would I test the script from the command line? I have my bot ID and chat ID, but not sure exactly what I should be putting in the command

Safihre commented 6 years ago

How do you run sabnzbd? Not as a service, right?

kilgil27 commented 6 years ago

I don't believe so, you have to set that up manually correct? I just have it starting when windows starts

caronc commented 6 years ago

How would I test the script from the command line? I have my bot ID and chat ID, but not sure exactly what I should be putting in the command

Earlier you wrote:

I am able to invoke it through the command prompt, and can attempt to run the script from the command prompt, but I get a syntax error when trying to run it...

So i thought you had already figured that out :wink:

Here is the link on how the Command Line Interface (CLI) works. In your case: your CLI line might look something like this:

# substitute the tgram:// entry with one that is associated with your account
python.exe C:\Path\To\SABnzbd\scripts\sabnzbd-notify.py complete 'Hello' 'World' tgram:///123456789:abcdefg_hijklmnop/12315544/

You'll want to make sure you set your self up correctly to allow webhooks in Telegram (I've documented this here).

caronc commented 6 years ago

@kilgil27 how did it go? Were you able to get it working? Just let me know so i can close off this ticket.

caronc commented 6 years ago

@kilgil27 I haven't heard back and it's been another month.

I'm going to close off this ticket now but feel free to inquire and I can re-open it at any time for you.