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

AttributeError: 'module' object has no attribute 'SSL_ST_INIT' #13

Closed Schnoogemetzger closed 7 years ago

Schnoogemetzger commented 7 years ago

Hi there,

first, thank you for the notify script. Works like a charm, at least for me since yesterday ;) I'm on Debian Testing and I updated my system yesterday (installed all outstanding upgradable packages to their newest version). There were some updates reagarding SSL and/or python. Since then, I get the following error, if I use Notify.py resp. sabnzbd-notify.py (with arguments):

Traceback (most recent call last):
  File "nzb-notify/Notify.py", line 290, in <module>
    from pnotify import *
  File "nzb-notify/Notify/pnotify/__init__.py", line 26, in <module>
    from NotifyBoxcar import NotifyBoxcar
  File "nzb-notify/Notify/pnotify/NotifyBoxcar.py", line 23, in <module>
    import requests
  File "nzb-notify/Notify/requests/__init__.py", line 53, in <module>
    from urllib3.contrib import pyopenssl
  File "nzb-notify/Notify/urllib3/contrib/pyopenssl.py", line 53, in <module>
    import OpenSSL.SSL
  File "nzb-notify/Notify/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "nzb-notify/Notify/OpenSSL/SSL.py", line 105, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Can you please help? I'm not familiar with python and I assume you need more informations or tests. Please let me know what do you need in order to get to the bottom of the problem.

Thx in advance!

caronc commented 7 years ago

Can't say I've fixed your issue, but there are 'a lot' of people having it with tons of other systems and packages (not just mine). It's a result of an incompatibility with pyOpenSSL introduced in pyOpenSSL v16.1.0. This is probably what you're running (see here). It was fixed in v16.2.0.

Now the version I ship with the (this) notify script is not impacted (but I think it's time I updated it anyway).

I'm pretty sure your problem is due to a globally installed pyOpenSSL package on your system is the bad version (identified above). See if there is an upgrade to it (since it appears to be over-riding the one I provide); you want any version but 16.1.0. Keep me posted either way; we'll figure out a way to get you going.

Edit: Sorry i meant to add; get the test version from the master branch here.

Schnoogemetzger commented 7 years ago

Hi again,

thank you for the fast response. Very nice of you :+1:

Can't say I've fixed your issue, but there are 'a lot' of people having it with tons of other systems and packages (not just mind). It's a result of an incompatibility with pyOpenSSL introduced in pyOpenSSL v16.1.0. This is probably what you're running (see here). It was fixed in v16.2.0.

Yeah you're right. Before I bothered you here :wink: , I tried several things include downgrade python and the openssl package. Without success. As matters stands now, all my Packages are up2date. And as you said, the whole Internet is full of this problem, since the beginning of November. Just for the sake of completeness, what versions are installed:

$ python -V
Python 2.7.13rc1

$ pip freeze | grep -iE 'crypto|ssl'
cryptography==1.5.3
pycrypto==2.6.1
pyOpenSSL==16.2.0

$ openssl version
OpenSSL 1.1.0c  10 Nov 2016

I just updated my local git repository from you master branch. The script don't work, but the SSL_ST_INIT error is no more. Now I get a new error. If I use Notify.py directly I get this with an exit code 95:

$ python Notify.py -D -s kodi://localhost -t "Hello" -b "World!"
...
2016-12-18 17:03:15,376 - 16923 - INFO - Quit Signal Received; Exiting.
2016-12-18 17:03:15,376 - 16923 - DEBUG - Exiting with return code: 95
$ echo $?
95

The main thing I use your notify script for is SABnzbd in combination with telegram.

$ python sabnzbd-notify.py complete 'foo' 'bar' tgram://<token>
2016-12-18 17:08:11,323 - 16986 - INFO - Quit Signal Received; Exiting.
$ echo $?
1

Exit code is different, but the problem remains. Thank you so much so far...

caronc commented 7 years ago

Sorry for taking so long to get back to you. Try checking out the master again and give'er another go! I was able to reproduce your problem and I think i fixed it.

Schnoogemetzger commented 7 years ago

Now it works again. Thank you!