Kodi Community Forum

Full Version: Python 2.6 Causes Failure In Crackler Add-On
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using Kodi (Isengard) on Mac OS. I'm having issues running the Crackler add-on. It generates a python exception as follows:
Code:
Error Type: <type 'exceptions.KeyError'>
Error Contents: ('v_id',)
Traceback (most recent call last):
File "/Users/cnguyen/Library/Application Support/Kodi/addons/plugin.video.crackler/default.py", line 202, in <module>
jsonurl = urllib2.urlopen(channel_detail_url % (args_ar['v_id'][0]))
KeyError: ('v_id',)

The problem is that Kodi ships with python 2.6. This add-on uses the urlparse module to parse out queries. In python version 2.7 and higher, the query is correctly extracted. But not in python 2.6. This leads to an empty query string resulting in an exception.

Quote:$ python
Python 2.7.9 (default, May 1 2015, 19:04:44)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.49)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urlparse
>>> r = urlparse.urlparse('plugin://plugin.video.crackler/?indx=0&mode=view_episodes&v_id=513')
>>> print r
ParseResult(scheme='plugin', netloc='plugin.video.crackler', path='/', params='', query='indx=0&mode=view_episodes&v_id=513', fragment='')
>>> print urlparse.parse_qs(r.query)
{'v_id': ['513'], 'indx': ['0'], 'mode': ['view_episodes']}

$ /usr/bin/python2.6
Python 2.6.9 (unknown, Aug 22 2015, 20:33:41)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urlparse
>>> r = urlparse.urlparse('plugin://plugin.video.crackler/?indx=0&mode=view_episodes&v_id=513')
>>> print r
ParseResult(scheme='plugin', netloc='plugin.video.crackler', path='/?indx=0&mode=view_episodes&v_id=513', params='', query='', fragment='')
>>> quit()

This post contains a workaround that involves changing the source code of the add-on. 219432 (thread)

It would be nice to have Kodi (Mac OS) ship with python 2.7.
v17 will be python 2.7

Report the problem with addon author for now