Beta script.module.kodi-six - a library for creating Python 2/3 compatible addons
#1
Exclamation 
Kodi Six (script.module.kodi-six) is an experimental library that I've created to simplify porting Kodi Python addons to Python 3. The library provides wrappers around xbmc* modules that normalize string handling in both Python 2 and Python 3 versions of Kodi API so that you don't need to use ad hoc string encoding and decoding in Python 2 - with Kodi Six Kodi API works the same way in both versions. Please read the Readme for more info.

Source code on GitHub: https://github.com/romanvm/kodi.six
Reply
#2
so basically with help of your module we will be converting our python2 projects to python3 projects.
then we will add your module on top of it and it will handle string vs unicode conversion inside our python3 compatible addon so its compatible with python2 (pre kodi 19.0) ?
Also we need to handle other aspect of compatibility like using proper urllib etc.
Reply
#3
I'm not sure what you are asking but kodi-six only normalizes string handling in Kodi Python API function/method arguments and return values. Everything else you need to do yourself.
Reply
#4
I have released the new version 0.1.0 (back-ported to gotham branch as 0.0.4) with changes that should bring major start-up performance improvements, especially on low-CPU platforms like Pi. Previously, if, for example, you did from kodi_six import xbmc all classes and functions from xbmc module were patched on import regardless on if they were actually used in the code, which slowed down addon start-up. Now patching is done lazily only when a specific function or class is first used, so, e.g. if you call xbmc.log(), log() function is patched on the first call and reference to the patched function is stored for further usage.
Reply
#5
Really stupid question, is this module in the kodi.tv repo so another Kodi device will be able to find and install this as a dependency?
Reply
#6
Yes it is available in the Official Kodi Repository.
Reply
#7
I recently pushed an update to an addon I maintain that uses Kodi-Six for python2/3 compatibility. Had two different users report errors where the debug logs points to the kodi-six module as being the source of a UnicodeDecode error. On both systems it's during an "xbmc.executeJSONRPC()" call. Below are both the debug logs

https://paste.kodi.tv/yowehuyisu.kodi - line 254
https://paste.kodi.tv/acoqakafes.kodi - line 1242

Anything jump out that could be the issue here? Anything I could do on my end to prevent these or is it an issue with kodi-six? I can make an issue on Github if this is more appropriate there.
Reply
#8
(2019-09-08, 22:29)robweber Wrote: I recently pushed an update to an addon I maintain that uses Kodi-Six for python2/3 compatibility. Had two different users report errors where the debug logs points to the kodi-six module as being the source of a UnicodeDecode error. On both systems it's during an "xbmc.executeJSONRPC()" call. Below are both the debug logs

https://paste.kodi.tv/yowehuyisu.kodi - line 254
https://paste.kodi.tv/acoqakafes.kodi - line 1242

Anything jump out that could be the issue here? Anything I could do on my end to prevent these or is it an issue with kodi-six? I can make an issue on Github if this is more appropriate there.
I would love to see something happen with this as well...also having issues
Kodi v18.4 with Aeon Nox:SiLVO / Using on Nvidea Shield, Android 7.1.2 on MeCool M8S Pro L-3GB/32GB and other Android TV Boxes as well as Windows 7 & 10
Reply
#9
There's not much that can be done if user's database contains textual information encoded not in UTF-8.
Reply
#10
Here is the Issue on Github where we discussed this in more detail for those interested: https://github.com/romanvm/kodi.six/issues/3
Reply
#11
Kodi-six utils.py was updated to use the surogateescape errorhandler.  However, my understanding is that surogateescape is only available since Python 3.1  I think maybe for Python 2 in it is possible to use the future module to register surogateescape as an errorhandler.  Here is a user debug log showing the issue (Kodi 18.5):  https://pastebin.com/jX8j8LTD

scott s.
.
maintainer of skin  Aeon MQ5 mods for post-Gotham Kodi releases:
Matrix see: Aeon MQ5 Mod Martix release thread
Leia see: Aeon MQ5 Mod Leia release thread
Reply
#12
Yes, my bad. I did not test it properly in Python 2. I don't want to add extra dependencies so I'll use "replace" error handler instead.
Reply
#13
(2019-12-17, 10:53)Roman_V_M Wrote: Yes, my bad. I did not test it properly in Python 2. I don't want to add extra dependencies so I'll use "replace" error handler instead.

Hi Roman,
I was trying to find this fix, hoping to get rid of the fanart error at start-up.
I'm a bit confused about the version numbers used. https://github.com/romanvm/kodi.six/tree...e.kodi-six shows 0.1.x
Edit: Apparently the six project versioning was adopted. I found the sources here: https://github.com/benjaminp/six
In Kodi itself currently I'm on script.module.six-1.13.0, and that version still exhibits the issue. Will there be an updated version of this module any time soon via the regular addon distribution channels?
Reply
#14
(2019-12-23, 09:20)Borre Wrote: Edit: Apparently the six project versioning was adopted.

Kodi-six and and six are completely different projects that have nothing in common. See the description of Kodi-six in the first post of this topic.
Reply
#15
Thanks for the fix in 0.1.3! The fanart error issue at Kodi startup is gone now.
Reply



Logout Mark Read Team Forum Stats Members Help
script.module.kodi-six - a library for creating Python 2/3 compatible addons0
This forum uses Lukasz Tkacz MyBB addons.