-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sabnzbd / Mattermost error: "module named ssl_match_hostname" #27
Comments
I don't really see the problem, the error it's failing on is already present. |
@caronc - the problem is that it won't send notifications to MM anymore. Umm, hard to say if anything updated, it's a headless box and updates software all the time but NO, Sab and MM were not udpated. |
You've stumped me on this one. The library it's looking for is in the Notify directory. Can you try checking out the master branch again? Or even better yet, use the last stable release? That will at least force your content to get replaced and filled (if anything is missing). l can't say with absolute certainty, but it would really appear like something got clobbered in your environment. |
@caronc - Okay, I pulled .6.1 - still same error. I mean, if something got "clobbered" then it must be a dependency that only SAB and/or this script uses because everything else is working fine on the box to include Mattermost and all the other apps that also send notifications to MM. Ie, Sonarr, Radarr, Headphones. Everything else works. Wasn't there a debug arg I could run manually? |
Sure, you could try running the tool from the command line. # Notify script by itself (-D is debug mode)
python Notify.py -D -t "Test Title" -b "Test Body" -s mmost://your/url/here
# SABnzbd wrapper
python sabnzbd-notify.py complete 'Hello' 'World' mmost://your/url/here But what you just stated in your last response is the weirdest part of this whole thing. It's failing on the version that I added the MattersMost feature for you :). It's the version that you left happy on (heh). That's why it just appears that something strange is going on on your side. I can't reproduce your error at all because it always successfully imports the backport module. I wonder if there is another module called 'backport' that is conflicting in your environment... hmm.. |
@caronc - yeah, I don't doubt that it's something strange on my side, I just cant' figure it out. It looks like a SSL issue, but that doesn't make sense as I haven't touched my certs in months, and I know they are still good
|
Make sure to change your password (or at least edit your previous post and scramble some of your details) when we're done here. I just sent a test message to your server by copying and pasting what you provided (i think). Still can't reproduce your issue at all. Do you see a C:\Sabnzbd\nzb-notify\Notify\backports/ssl_match_hostname/__init__.py directory at all? It almost seems like it's missing for you. Make sure if the file is present, it's not zero bytes. Did you install another addon recently? It's possible there is another backports module/directory on your device that is over-riding the one provided. Another thing you could try (just to see if you can even import the module yourself is: # Start up an instance of python this way (setting a path first - the same
# path the notify script does):
export PYTHONPATH="C:\Sabnzbd\nzb-notify\Notify"
# Or if doing from windows:
set PYTHONPATH="C:\Sabnzbd\nzb-notify\Notify"
# now start up python
python Then from within python type: from backports.ssl_match_hostname import CertificateError
# Hopefully you don't get an error doing this Another thing you could try is deleting the Notify module complete (everything) and just checking out a brand new copy (if you hadn't already). The only thing this will do is ensure you're starting with no .pyc and/or .pyo files that may or may not be causing you issues. It will force them to get recreated. Alternatively, you could just make ssl_match_hostname globally available to your device: Good luck! |
@caronc - you scared me for a second...I was like WTF did that come from. So I have good news: SIMPLE fix: pip install backports.ssl_match_hostname BAM. All good, not sure what changed, but that did it. Might wanna update your dependencies or something, might have just been me, but I have no idea what updated or why it stopped working. THANKS! |
@caronc I am also getting this error when downloading the zip and just setting it as SABnzbd Notification Script. I guess I could
And:
Works in Python 3.6 though:
|
FYI, MM notifications are still working for me. |
@seanvree, but you used pip install to fix your problem; we kind of just buried it with that workaround 😉. @Safihre has a point: there is simply no reason why this archive shouldn't just work out of the box (without having to install the extra packaging that you did). But now with respect to the issue: I just created a simple docker image with a plain-jane OS and it works for me. Here is what i did: # A Simple CentOS image:
docker pull centos
# Run the instance
docker run -i -t centos /bin/bash
# Inside the docker instance:
# I installed wget and unzip (since it isn't already available)
yum install wget unzip -y
# Python is included, but backports is not:
rpm -qa | egrep -i backports; echo $?
1
# Launch latest NZB-Notify
wget https://github.com/caronc/nzb-notify/archive/master.zip
unzip master.zip
nzb-notify-master/Notify.py -D -s mmosts://myuser@domain.com/auth?verify=False
# It gracefully returns (as I'd want it to) I'll wait back to hear on what you're environment is. |
Windows 10! |
Well... i found the problem, but i don't know what the fix is yet. Python 2.7.13 defaults it's install into C:\Python27. It creates several subdirectories within this; one of which is C:\Python27\lib\site-packages\backports. So just out of the box (without this script installed): import backports
print(backports.__path__)
# C:\Python27\lib\site-packages\backports It appears the windows install of Python ignores the first few lines of the Notify.py script which forces the path to search our Notify directory first (wherever it is): import sys
from os.path import join
from os.path import abspath
from os.path import dirname
sys.path.insert(0, join(dirname(abspath(__file__)), 'Notify')) In windows this is definitely broken; because when i revisit the first block of code (ran from the same directory the Notify.py and Notify directory are in): import sys
from os import getcwd
from os.path import join
sys.path.insert(0, join(getcwd(), 'Notify'))
# Now if we import backports, we should find the one in our Notify directory
import backports
print(backports.__path__) # Nope... :(
# C:\Python27\lib\site-packages\backports
# What's weird is it's not entirely broken... you can do the following:
import chardet
print(chardet.__path__)
# Prints my path to Notify/chardet What's really weird, is (in Windows) even if i delete the C:\Python27\lib\site-packages\backports, it still imports the module; so it's like part of the Python27 build in some way. Alternatively (as we already know) pip install works because it drops the correct package in this site-packages\backports directory. So basically, the Microsoft version of Python27 can't seem to stop referencing (even when told not to) the backports location. |
I created a ticket with Python's bug tracker which will hopefully either have some guy call me an idiot and point out what I'm missing here. Or alternatively; maybe this really is a bug and it can get fixed upstream 😄. |
So Python dev's closed the ticket and pointed out that the configparser (installed with pip) is what is monkeying around with the backports module. So if you can't beat em, join em. Renaming backports to _backports (and changing all references) should bypass the problem since the keyword (backports) is clearly reserved. |
I'm going to close this ticket as I'm confident that renaming the backports directory should stop windows environments from ignoring it's contents. Feel free to let me know if you're still hindered; I'll gladly re-open the ticket and keep digging! 🕳 |
OS: Windows 10E x64
Sabnzbd: 2.1.0 [443efb5]
Not sure what changed, but the notifications just stopped working with MassterMost.
SABnzbd Notification settings:
mmosts://sabnzbd@mydomain.com/ifeaht4hpt89mrijxdpwxxxxxx?verify=False
Screenshot:
The text was updated successfully, but these errors were encountered: