Hello.
A french user on our forum complain about script error each time he try to change view :
Code:
14:16:32 T:139917876647680 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.UnicodeEncodeError'>
Error Contents: 'ascii' codec can't encode character u'xe9' in position 7: ordinal not in range(128)
Traceback (most recent call last):
File "/root/.kodi/addons/script.skin.helper.service/default.py", line 290, in <module>
Main()
File "/root/.kodi/addons/script.skin.helper.service/default.py", line 44, in __init__
mainmodule.setView()
File "/root/.kodi/addons/script.skin.helper.service/resources/lib/MainModule.py", line 162, in setView
viewid, viewlabel = selectView(contenttype, currentView)
File "/root/.kodi/addons/script.skin.helper.service/resources/lib/MainModule.py", line 242, in selectView
label = xbmc.getLocalizedString(int(view.attributes[ 'languageid' ].nodeValue)).decode("utf-8")
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'xe9' in position 7: ordinal not in range(128)
-->End of Python script error report<--
He's using Titan skin.
This error occurs because views name for this skin use accented letter (as we run Kodi in French) such as :
Code:
msgctxt "#31442"
msgid "Low List"
msgstr "Liste réduite"
After some tests, I only remove .decode("utf-8") from line 242 in MainModule.py and no more script error and you chan change view in the skin.
So I guess xbmc.getLocalizedString(int(view.attributes[ 'languageid' ].nodeValue)) is enough to retrieve label, even is local language is non standard character.
Line 242 now :
Code:
label = xbmc.getLocalizedString(int(view.attributes[ 'languageid' ].nodeValue))
Hope this could help.