Kodi Community Forum

Full Version: BeautifulSoup4 not Python3 compatible?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Taken the first stumbling steps towards moving my addons to Python3.

As I understand, most module addons are supposed to be 2/3 compatible already? Is that correct?

I have run into an issue with BeautifulSoup4, i.e.
Code:
from bs4 import BeautifulSoup

Code:

2019-09-06 11:08:03.916 T:18446744073709551614   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'ModuleNotFoundError'>
                                            Error Contents: No module named 'htmlentitydefs'
                                            Traceback (most recent call last):
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\weather.ozweather\default.py", line 35, in <module>
                                                from weatherzone import *
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\weather.ozweather\resources\lib\weatherzone.py", line 20, in <module>
                                                from bs4 import BeautifulSoup
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\script.module.beautifulsoup4\lib\bs4\__init__.py", line 36, in <module>
                                                from .builder import builder_registry, ParserRejectedMarkup
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\script.module.beautifulsoup4\lib\bs4\builder\__init__.py", line 7, in <module>
                                                from bs4.element import (
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\script.module.beautifulsoup4\lib\bs4\element.py", line 13, in <module>
                                                from bs4.dammit import EntitySubstitution
                                              File "C:\Kodi\Leia-Python3\portable_data\addons\script.module.beautifulsoup4\lib\bs4\dammit.py", line 14, in <module>
                                                from htmlentitydefs import codepoint2name
                                            ModuleNotFoundError: No module named 'htmlentitydefs'
                                            -->End of Python script error report<--

Is the sort of thing where we just have to wait for a fix?  Is there a proper place to report these sorts of issues as we run in to them?
I investigated this error and found out that the Kodi Python 3 test build is using the BeautifulSoup4 Python 2 version. That's obviously a bug.
For now you have to manually download http://mirrors.kodi.tv/addons/migration/...-4.6.3.zip and install this package in Kodi with "Install from zip file"
I reported this problem at 16577 (GH issue)
Thanks for your response - that is helpful.  I'll get back on to this soon and try that out...it's the major dependency for my main addon, so definitely needed!