Kolifanes / plugin.video.youtube

YouTube for Kodi with API fixed
GNU General Public License v2.0
119 stars 44 forks source link

urlopen error [Errno 0] Error prevents any window from the plugin opening #131

Open Rudd-O opened 7 years ago

Rudd-O commented 7 years ago

Clean profile, no youtube addon data on disk. Start. Open the addon. No luck. Youtube error, check log. Log here:

22:26:10 T:140331662096128 WARNING: [plugin.video.youtube] Switching API key set from  to 1
22:26:10 T:140331662096128  NOTICE: [plugin.video.youtube] Running: YouTube (5.3.8) on Jarvis (Kodi-16.1) with Python 2.7.12
22:26:14 T:140331662096128  NOTICE: Previous line repeats 2 times.
22:26:14 T:140331662096128   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'urllib2.URLError'>
                                            Error Contents: <urlopen error [Errno 0] Error>
                                            Traceback (most recent call last):
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/default.py", line 7, in <module>
                                                runner.run(__provider__)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/runner.py", line 32, in run
                                                __RUNNER__.run(provider, context)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/impl/xbmc/xbmc_runner.py", line 23, in run
                                                results = provider.navigate(context)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/abstract_provider.py", line 83, in navigate
                                                self._process_wizard(context)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/abstract_provider.py", line 73, in _process_wizard
                                                wizard_step[0](*wizard_step[1])
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/youtube/helper/yt_setup_wizard.py", line 58, in process
                                                _process_language(provider, context)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/youtube/helper/yt_setup_wizard.py", line 16, in _process_language
                                                json_data = client.get_supported_languages(kodi_language)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/youtube/client/youtube.py", line 104, in get_supported_languages
                                                return self._perform_v3_request(method='GET', path='i18nLanguages', params=params)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/youtube/client/youtube.py", line 615, in _perform_v3_request
                                                result = requests.get(_url, params=_params, headers=_headers, verify=False, allow_redirects=allow_redirects)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/simple_requests/api.py", line 189, in get
                                                return _request('GET', url, **kwargs)
                                              File "/home/user/.kodi/addons/old.plugin.video.youtube/resources/lib/kodion/simple_requests/api.py", line 165, in _request
                                                response = opener.open(request)
                                              File "/usr/lib64/python2.7/urllib2.py", line 429, in open
                                                response = self._open(req, data)
                                              File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
                                                '_open', req)
                                              File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
                                                result = func(*args)
                                              File "/usr/lib64/python2.7/urllib2.py", line 1243, in https_open
                                                context=self._context)
                                              File "/usr/lib64/python2.7/urllib2.py", line 1200, in do_open
                                                raise URLError(err)
                                            URLError: <urlopen error [Errno 0] Error>
                                            -->End of Python script error report<--

Using latest addon available in the Kodi repo, and using Jarvis Kodi.

Rudd-O commented 7 years ago

After hours of struggling, I got the mufuggen fix:

diff --git a/resources/lib/kodion/simple_requests/api.py b/resources/lib/kodion/simple_requests/api.py
index 782d776..aa0a0f4 100755
--- a/resources/lib/kodion/simple_requests/api.py
+++ b/resources/lib/kodion/simple_requests/api.py
@@ -1,5 +1,7 @@
 __author__ = 'bromix'

+import OpenSSL
+
 import urllib
 import urllib2
 from StringIO import StringIO

That's right — just importing the OpenSSL module before importing urllib* fixes it all. No need to downgrade anything. Just do this and that's it. But do it on every module that imports urllib*.

BurninTurtles commented 7 years ago

The above comment by @Rudd-O is important. i went through a fresh install of everything and immediately this addon started giving these exact errors. adding the line to import openssl fixed it. we should get this into the repo as soon as possible.

eljenso commented 7 years ago

Just added this line on my machine after having issues with this addon and it went from 'not working at all' to 'everything works'.

jordanade commented 6 years ago

I keep getting the WARNING "Switching API key set from to 1" and I lose my login and personal API keys. Very annoying.

rubdos commented 6 years ago

I had this exact same problem on the lastfm scrobbler, is this something that needs fixing in Kodi itself?