2022-01-13, 18:54
Hi,
rt plugin is failing with python3 in kodi matrix because of changes in how unescape is handled in python3. The unescape() method in the html.parser.HTMLParser class has been removed in Python 3.9 (it was deprecated since Python 3.4), and seems that html.unescape() should be used for converting character references to the corresponding unicode characters.
From kodi.log:
File "/home/pi/.kodi/addons/plugin.video.rt/resources/lib/scraper.py", line 15, in <module>
UNESCAPE = html.parser.HTMLParser().unescape
AttributeError: 'HTMLParser' object has no attribute 'unescape'
Change in .diff below seems to work with python3 and I hope should preserve backwards compatibility
--- a/plugin.video.rt/resources/lib/scraper.py
+++ b/plugin.video.rt/resources/lib/scraper.py
@@ -12,7 +12,11 @@ import html.parser
import sys
import requests
-UNESCAPE = html.parser.HTMLParser().unescape
+if sys.version_info[0] >= 3:
+ UNESCAPE = html.unescape
+else:
+ UNESCAPE = html.parser.HTMLParser().unescape
+
RTBASE = 'https://www.rt.com/rtmobile/'
LCL = xbmcaddon.Addon('plugin.video.rt').getLocalizedString
rt plugin is failing with python3 in kodi matrix because of changes in how unescape is handled in python3. The unescape() method in the html.parser.HTMLParser class has been removed in Python 3.9 (it was deprecated since Python 3.4), and seems that html.unescape() should be used for converting character references to the corresponding unicode characters.
From kodi.log:
File "/home/pi/.kodi/addons/plugin.video.rt/resources/lib/scraper.py", line 15, in <module>
UNESCAPE = html.parser.HTMLParser().unescape
AttributeError: 'HTMLParser' object has no attribute 'unescape'
Change in .diff below seems to work with python3 and I hope should preserve backwards compatibility
--- a/plugin.video.rt/resources/lib/scraper.py
+++ b/plugin.video.rt/resources/lib/scraper.py
@@ -12,7 +12,11 @@ import html.parser
import sys
import requests
-UNESCAPE = html.parser.HTMLParser().unescape
+if sys.version_info[0] >= 3:
+ UNESCAPE = html.unescape
+else:
+ UNESCAPE = html.parser.HTMLParser().unescape
+
RTBASE = 'https://www.rt.com/rtmobile/'
LCL = xbmcaddon.Addon('plugin.video.rt').getLocalizedString