custom-components / feedparser

📰 RSS Feed Integration
MIT License
145 stars 33 forks source link

Integration fails to load with HA 2024.12.0b1: "no module named 'cgi'" #134

Open ResteNarquois opened 13 hours ago

ResteNarquois commented 13 hours ago

Feedparser v0.1.11 fails to load with HA version 2024.12.0b1 with error message "no module named 'cgi'".

At an uneducated guess, this looks like it may be connected to the upgrade to Python 3.13 in this version of HA.

Full error message:

Logger: homeassistant.config
Source: config.py:1055
First occurred: 11:19:26 (1 occurrences)
Last logged: 11:19:26

Platform error: sensor - No module named 'cgi'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1055, in _async_load_and_validate_platform_integration
    platform = await p_integration.integration.async_get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1104, in async_get_platform
    platforms = await self.async_get_platforms((platform_name,))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1181, in async_get_platforms
    import_future.result()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1151, in async_get_platforms
    await self.hass.async_add_import_executor_job(
        self._load_platforms, platform_names
    )
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1094, in _load_platforms
    platform_name: self._load_platform(platform_name)
                   ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1268, in _load_platform
    cache[full_name] = self._import_platform(platform_name)
                       ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1300, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/feedparser/sensor.py", line 18, in <module>
    import feedparser
  File "/usr/local/lib/python3.13/site-packages/feedparser/__init__.py", line 28, in <module>
    from .api import parse
  File "/usr/local/lib/python3.13/site-packages/feedparser/api.py", line 35, in <module>
    from .encodings import convert_to_utf8
  File "/usr/local/lib/python3.13/site-packages/feedparser/encodings.py", line 29, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'
ResteNarquois commented 13 hours ago

Seems the module was indeed slated for removal in Python 3.13.

Not sure if this fork is of any relevance.