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

Protobuf Error, TypeError: Descriptors cannot not be created directly. #38

Open
MartinStoev00 opened this issue May 30, 2023 · 1 comment

Comments

@MartinStoev00
Copy link

I am getting the following error and am not sure how to fix:

Traceback (most recent call last):
File "/usr/bin/spodcast", line 5, in
from spodcast.main import main
File "/usr/lib/python3.11/site-packages/spodcast/main.py", line 4, in
from spodcast.app import client
File "/usr/lib/python3.11/site-packages/spodcast/app.py", line 4, in
from librespot.audio.decoders import AudioQuality
File "/home/martins/.local/lib/python3.11/site-packages/librespot/init.py", line 3, in
from librespot.proto.Keyexchange_pb2 import BuildInfo, Platform, Product, ProductFlags
File "/home/martins/.local/lib/python3.11/site-packages/librespot/proto/Keyexchange_pb2.py", line 31, in
_descriptor.EnumValueDescriptor(
File "/home/martins/.local/lib/python3.11/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

@histoicism
Copy link

downgrading to protobuf 3.20.1 did the trick
pip3 install protobuf==3.20.1

releases list: https://pypi.org/project/protobuf/#history

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

2 participants