Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after upgrading to Release 2023.4.5 - Protocol Buffers Error? #27

Open
christopherdopp opened this issue Apr 18, 2023 · 1 comment

Comments

@christopherdopp
Copy link

christopherdopp commented Apr 18, 2023

After upgrading to 2023.4.5 I am getting the following error in my home-assistant.log file.

2023-04-18 11:56:23.726 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up gtfs_rt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gtfs_rt/sensor.py", line 78, in setup_platform
    sensors.append(PublicTransportSensor(
  File "/config/custom_components/gtfs_rt/sensor.py", line 97, in __init__
    self.update()
  File "/config/custom_components/gtfs_rt/sensor.py", line 145, in update
    self.data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/gtfs_rt/sensor.py", line 167, in update
    positions, vehicles_trips, occupancy = self._get_vehicle_positions() if self._vehicle_position_url else [{}, {}, {}]
  File "/config/custom_components/gtfs_rt/sensor.py", line 220, in _get_vehicle_positions
    from google.transit import gtfs_realtime_pb2
  File "/usr/local/lib/python3.10/site-packages/google/transit/gtfs_realtime_pb2.py", line 50, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 796, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Prior to this it has been working without issue. I have not changed my gtfs_rt configuration at all. I just noticed that sensors that normally are populated with realtime data do not exist.

Following the link at the bottom of the message indicates changes with Python Updates of Protocol Buffers.

corneels referenced this issue in corneels/ha-gtfs-rt-v2 Apr 22, 2023
gtfs-realtime-bindings 1.0.0 contains an updated _pb2.py file which fixes issue mark1foley#27
@christopherdopp
Copy link
Author

I switched to the latest release on the ha-gtfs-rt-v2 fork and my gtfs feeds are working again without any exceptions in the homeassistant.log file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant