Jump to content
boeboe

Python version upstep for Kodi required

Recommended Posts

Hi,

I am running into troubles with several Kodi add-on's due to the Python version being too old and as a result SSL Handshake issues.

Model:HS-251
Current firmware version:4.3.5.0760 ; Date:2018/11/14

Kodi Version 17.5.0.0 (https://www.qnapclub.eu/en/qpkg/releasenotes/405)
Example addon: vrt.nu 1.4.3 (https://kodi.tv/addon/plugins-video-add-ons/vrt-nu-0)


Traces of the Python version / SSL Handshake issue:

CODE: SELECTEER ALLES

10:36:29.348 T:139714001778432   DEBUG: 2.7.6 (default, Mar 22 2014, 23:03:41) 
                                            [GCC 4.8.2]
10:36:29.348 T:139714001778432   DEBUG: /usr/bin/python
10:36:29.348 T:139714001778432   DEBUG: /usr
10:36:29.348 T:139714001778432   DEBUG: ['plugin://plugin.video.vrt.nu/', '3', '?action=playlive&video=https%3A%2F%2Fmedia-services-public.vrt.be%2Fvualto-video-aggregator-web%2Frest%2Fexternal%2Fv1%2Fvideos%2Fvualto_canvas_geo']
10:36:29.348 T:139714001778432   DEBUG: ['/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu', '/opt/Kodi17/.kodi/addons/script.module.beautifulsoup4/lib', '/opt/Kodi17/.kodi/addons/script.module.certifi/lib', '/opt/Kodi17/.kodi/addons/script.module.chardet/lib', '/opt/Kodi17/.kodi/addons/script.module.idna/lib', '/opt/Kodi17/.kodi/addons/script.module.requests/lib', '/opt/Kodi17/.kodi/addons/script.module.urllib3/lib', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0']
10:36:29.348 T:139714001778432   DEBUG: /usr
10:36:29.436 T:139714001778432   ERROR: /opt/Kodi17/.kodi/addons/script.module.urllib3/lib/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
                                              SNIMissingWarning
10:36:29.436 T:139714001778432   ERROR: /opt/Kodi17/.kodi/addons/script.module.urllib3/lib/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
                                              InsecurePlatformWarning
10:36:30.817 T:139714001778432   ERROR: Previous line repeats 3 times.
10:36:30.818 T:139714001778432   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'requests.exceptions.SSLError'>
                                            Error Contents: HTTPSConnectionPool(host='www.vrt.be', port=443): Max retries exceeded with url: /vrtnu/ (Caused by SSLError(SSLError(1, '_ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'),))
                                            Traceback (most recent call last):
                                              File "/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu/addon.py", line 49, in <module>
                                                router(sys.argv[2][1:])
                                              File "/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu/addon.py", line 44, in router
                                                vrt_player.play_livestream(params['video'])
                                              File "/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu/resources/lib/vrtplayer/vrtplayer.py", line 83, in play_livestream
                                                stream = self.url_to_livestream_service.get_stream_from_url(url)
                                              File "/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu/resources/lib/vrtplayer/urltolivestreamservice.py", line 13, in get_stream_from_url
                                                (session, token) = super(UrlToLivestreamService, self)._get_session_and_token_from_()
                                              File "/opt/Kodi17/.kodi/addons/plugin.video.vrt.nu/resources/lib/vrtplayer/streamservice.py", line 53, in _get_session_and_token_from_
                                                response = session.post('https://login.vrt.be/perform_login', data=data)
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 559, in post
                                                return self.request('POST', url, data=data, json=json, **kwargs)
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 512, in request
                                                resp = self.send(prep, **send_kwargs)
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 644, in send
                                                history = [resp for resp in gen] if allow_redirects else []
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 222, in resolve_redirects
                                                **adapter_kwargs
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 622, in send
                                                r = adapter.send(request, **kwargs)
                                              File "/opt/Kodi17/.kodi/addons/script.module.requests/lib/requests/adapters.py", line 511, in send
                                                raise SSLError(e, request=request)
                                            SSLError: HTTPSConnectionPool(host='www.vrt.be', port=443): Max retries exceeded with url: /vrtnu/ (Caused by SSLError(SSLError(1, '_ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'),))
                                            -->End of Python script error report<--
10:36:30.825 T:139715279251456   DEBUG: ------ Window Init (DialogNotification.xml) ------

The first 6 DEBUG lines are displayed because I added some extra debug information in the addon.py file of this addon (located in /share/CACHEDEV1_DATA/.qpkg/Kodi17/opt/.kodi/addons/plugin.video.vrt.nu):

CODE: SELECTEER ALLES

print(sys.version)
print(sys.executable)
print(sys.exec_prefix)
print(sys.argv)
print(sys.path)
print(sys.prefix)

I cannot explain why the plugin detects Python 2.7.6, as I have done a command line search on the complete system and this version is not available.

Several extra information (certifi is available):

CODE: SELECTEER ALLES

[/share/CACHEDEV1_DATA/.qpkg/Kodi17/opt/.kodi/addons] # ls -1
metadata.album.universal/
metadata.artists.universal/
metadata.common.allmusic.com/
metadata.common.fanart.tv/
metadata.common.imdb.com/
metadata.common.musicbrainz.org/
metadata.common.theaudiodb.com/
metadata.common.themoviedb.org/
metadata.themoviedb.org/
metadata.tvdb.com/
packages/
plugin.program.indigo/
plugin.video.udacity/
plugin.video.uzg/
plugin.video.vrt.nu/
plugin.video.youtube/
repository.meta/
repository.xbmchub/
script.module.addon.common/
script.module.beautifulsoup/
script.module.beautifulsoup4/
script.module.certifi/
script.module.chardet/
script.module.idna/
script.module.metahandler/
script.module.myconnpy/
script.module.requests/
script.module.resolveurl/
script.module.simplejson/
script.module.six/
script.module.urllib3/
script.module.urlresolver/
script.module.xbmcswift2/
script.tvaddons.debug.log/
service.xbmc.versioncheck/
temp/

The different versions of Python on my QNAP (this really is a mess and notice the version 2.7.6 reported by Python within Kodi is NOT in this list):

CODE: SELECTEER ALLES

[/] # find / -name python | grep bin | xargs -i sh -c 'echo {} : && {} --version'     
/usr/local/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/Python/src/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/Entware-3x/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/QPyload/bin/python :
Python 2.7.13
/share/CACHEDEV1_DATA/.qpkg/LetsEncrypt/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/Qffmpeg/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/QDebian/rootfs/usr/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/HD_Station/usr/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/CloudLink/python/bin/python :
Python 2.7.13
/share/CACHEDEV1_DATA/.qpkg/QPython2/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/XBMC/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/CodexPack/usr/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/container-station/usr/local/container-station/python/bin/python :
Python 2.7.3
/share/CACHEDEV1_DATA/.qpkg/container-station/usr/local/container-station/python/bin/.libs/python :
Python 2.7.3
/share/CACHEDEV1_DATA/.qpkg/Qcenter/python/bin/python :
Python 2.7.5
/share/CACHEDEV1_DATA/.qpkg/Qcenter-Agent/python32/bin/python :
Python 2.7.15
/share/CACHEDEV1_DATA/.qpkg/Qcenter-Agent/python64/bin/python :
Python 2.7.15
/mnt/ext/opt/Python/bin/python :
Python 2.7.5

Anyone any idea how I can make sure Kodi takes a more up to date version of Python and/or how I can get around this SSL issue?

Thanks,
Bart

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×