willforde / script.module.codequick

Kodi addon framework
GNU General Public License v2.0
33 stars 6 forks source link

UnicodeEncodeError in support.py #14

Closed sy6sy2 closed 6 years ago

sy6sy2 commented 6 years ago

It seems that the line https://github.com/willforde/script.module.codequick/blob/c394dc329ef1278631a60d427a3d150cebddad4a/script.module.codequick/lib/codequick/support.py#L287

trigger an UnicodeEncodeError when there is accent in the e variable.

This is my test with this code:

[...]
print('repr(e.__class__.__name__): ' + repr(e.__class__.__name__))
print('repr(e): ' + repr(e))
print('repr(addon_data.getAddonInfo("icon")): ' + repr(addon_data.getAddonInfo("icon")))
dialog.notification(e.__class__.__name__, str(e), addon_data.getAddonInfo("icon"))
[...]

I get:

22:00:13.147 T:123145537683456   DEBUG: repr(e.__class__.__name__): 'RuntimeError'
22:00:13.148 T:123145537683456   DEBUG: repr(e): RuntimeError(u"Impossible de r\xe9soudre l'URL",)
22:00:13.148 T:123145537683456   DEBUG: repr(addon_data.getAddonInfo("icon")): '/Users/sylvain/Library/Application Support/Kodi/addons/plugin.video.catchuptvandmore/icon.png'
22:00:13.149 T:123145533390848    INFO: initializing python engine.
22:00:13.149 T:123145533390848   DEBUG: CPythonInvoker(73, /Users/sylvain/Library/Application Support/Kodi/addons/script.module.youtube.dl/service.py): start processing
22:00:13.175 T:123145537683456   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 15: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/Users/sylvain/Library/Application Support/Kodi/addons/plugin.video.catchuptvandmore/addon.py", line 420, in <module>
                                                main()
                                              File "/Users/sylvain/Library/Application Support/Kodi/addons/plugin.video.catchuptvandmore/addon.py", line 416, in main
                                                run()
                                              File "/Users/sylvain/Library/Application Support/Kodi/addons/script.module.codequick/lib/codequick/support.py", line 290, in run_callback
                                                dialog.notification(e.__class__.__name__, str(e), addon_data.getAddonInfo("icon"))
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 15: ordinal not in range(128)
                                            -->End of Python script error report<--

Thank you ;-)

cc @wwark

Edit: I am with Kodi 17

willforde commented 6 years ago

It should be fixed now. Thanks.

wwark commented 6 years ago

Hi Willforde,

I tried the new version of codequick contains this fix. Meanwhile, I have also this error. Do you think it needs a new fix?

01:23:09.991 T:140697863198464 FATAL: [Catch-up-TV-&-More.support] 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128) Traceback (most recent call last): File "/home/wark/.kodi/addons/script.module.codequick/lib/codequick/support.py", line 282, in run_callback parent_ins._process_results(results) File "/home/wark/.kodi/addons/script.module.codequick/lib/codequick/route.py", line 89, in _process_results raw_listitems = validate_listitems(raw_listitems) File "/home/wark/.kodi/addons/script.module.codequick/lib/codequick/route.py", line 33, in validate_listitems raw_listitems = list(raw_listitems) File "/home/wark/.kodi/addons/plugin.video.catchuptvandmore/resources/lib/channels/fr/rmcstory.py", line 129, in list_videos date_list = utils.strip_tags(str(info_video[2])).split(' ') UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Thanks in advance, Wwark

willforde commented 6 years ago

Sorry but it looks more like a problem in your code at line 129, in resources/lib/channels/fr/rmcstory.py:list_videos

wwark commented 6 years ago

Thank you to pointing me that. I will look on my side. Wwark