caronc / nzb-subliminal

Fetches subtitles for the videos it's provided. It can be easily integrated into NZBGet and SABnzbd too.
GNU General Public License v3.0
103 stars 14 forks source link

OpenSSL error #39

Closed pguizeline closed 7 years ago

pguizeline commented 7 years ago

Hi,

When running a scan with this parameters:

/home/ubuntu/nzbget-subliminal/Subliminal.py -S /home/ubuntu/Media/ \
-a 360 \
-l en \
-e utf-8 \
--addic7ed-user=XXX \
--addic7ed-pass=XXX \
-t

I get the following error:

2017-10-11 13:18:36,713 - 19986 - ERROR - Fatal Exception:
  Traceback (most recent call last):
    File "/home/ubuntu/nzbget-subliminal/Subliminal/nzbget/ScriptBase.py", line 2935, in run
    exit_code = main_function(*args, **kwargs)
    File "/home/ubuntu/nzbget-subliminal/Subliminal.py", line 1936, in main
    use_nzbheaders=False,
    File "/home/ubuntu/nzbget-subliminal/Subliminal.py", line 1547, in subliminal_fetch
    hi_score_adjust=hi_score_adjust,
    File "/home/ubuntu/nzbget-subliminal/Subliminal/subliminal/api.py", line 215, in download_best_subtitles
    Provider = provider_entry_point.load()
    File "/home/ubuntu/nzbget-subliminal/Subliminal/pkg_resources.py", line 1948, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
    File "/home/ubuntu/nzbget-subliminal/Subliminal/subliminal/providers/__init__.py", line 10, in <module>
    import requests
    File "/home/ubuntu/nzbget-subliminal/Subliminal/requests/__init__.py", line 53, in <module>
    from urllib3.contrib import pyopenssl
    File "/home/ubuntu/nzbget-subliminal/Subliminal/urllib3/contrib/pyopenssl.py", line 53, in <module>
    import OpenSSL.SSL
    File "/home/ubuntu/nzbget-subliminal/Subliminal/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
    File "/home/ubuntu/nzbget-subliminal/Subliminal/OpenSSL/SSL.py", line 105, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
  AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Maybe I need to update pyOpenSSL?

caronc commented 7 years ago

Yes, it's the same as this ticket here.

Basically pyOpenSSL 16.1.0 was a bad release (but a lot of systems picked it up - including yours). If you upgrade pyOpenSSL to v16.2.0 or higher you'll be good to go.

Here is the official link of the poor developer getting reamed for releasing 16.1.0 when it wasn't tested properly (catching this bug you're referring to). It also refers to the update (to v16.2.0 fixing everything)

Good luck!

pguizeline commented 7 years ago

Hi! Thanks for the reply! I'm running Ubuntu 16.04 LTS, here are my python packages:

python -V
Python 2.7.12

pip freeze | grep -iE 'crypto|ssl'
asn1crypto==0.22.0
cryptography==2.0.3
pycrypto==2.6.1
pyOpenSSL==17.0.0

So it should just work right?

caronc commented 7 years ago

Well.. since you put it that way... yeah it should work! :blush:.

Let me go back to the drawing board and see what i can find out. Hopefully (worst case scenario) I'll something new for you by the end of this weekend.

caronc commented 7 years ago

After doing a bit of research, i can tell you that cryptography is very tightly coupled with pyOpenSSL. If your version of cryptography (v2.0.3) and your version of pyOpenSSL (v17.0.0) work properly together then the best solution is to just delete the nzbget-sublimial/OpenSSL directory (the one i provide). It's possible my provided version (v16.2.0) is what is causing you all of your pain. If that directory is missing it will use the global one you already have provided. this may fix your problem.

The error your displaying to me is a unfortunate though because up until now each of these packages (pyOpenSSL & cryptography) were always backwards compatible with one another (except the dreaded v16.1.0 release). It looks like everything is broken again or at least very version dependant. ☹️

pguizeline commented 7 years ago

I've deleted the provided pyOpenSSL directory and now it works!! Thanks!

caronc commented 7 years ago

Great! I'm not sure yet how to tackle this because if I delete nzbget-subliminal/OpenSSL on my end, I run the risk of breaking the setup for others who are still using it. On the other hand, you just proved to me it can also break peoples configurations as well. Not only that, you've just shown me how out of date my copy of OpenSSL is :wink:. So I do feel the need to do something.

If you don't mind, i'm going to leave this ticket open as a slap in the face (for me) to do something about this since my current solution doesn't accommodate everyone anymore.