You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why do I get the following error when running example.py
$ python3 example.py
Traceback (most recent call last):
File "/mnt/c/tmp/tahu/python/examples/example.py", line 19, in
import sparkplug_b as sparkplug
File "/mnt/c/tmp/tahu/python/examples/../core/sparkplug_b.py", line 13, in
import sparkplug_b_pb2
File "/mnt/c/tmp/tahu/python/examples/../core/sparkplug_b_pb2.py", line 29, in
_PAYLOAD_TEMPLATE_PARAMETER_PARAMETERVALUEEXTENSION = _descriptor.Descriptor(
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/descriptor.py", line 313, 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:
Downgrade the protobuf package to 3.20.x or lower.
Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
The text was updated successfully, but these errors were encountered:
Chances are you are getting this because you are running a version of the protobuf package >3.20.x and the sparkplug_b_pb2.py file in this repo hasn't been regenerated with a compatible version of protoc. I regenerated the sparkplug_b_pb2.py file and the error went away for me.
I'm running protobuf version 4.21.9.
If you are using pip, you can check your version by running: pip show protobuf
Why do I get the following error when running example.py
$ python3 example.py
Traceback (most recent call last):
File "/mnt/c/tmp/tahu/python/examples/example.py", line 19, in
import sparkplug_b as sparkplug
File "/mnt/c/tmp/tahu/python/examples/../core/sparkplug_b.py", line 13, in
import sparkplug_b_pb2
File "/mnt/c/tmp/tahu/python/examples/../core/sparkplug_b_pb2.py", line 29, in
_PAYLOAD_TEMPLATE_PARAMETER_PARAMETERVALUEEXTENSION = _descriptor.Descriptor(
File "/usr/local/lib/python3.10/dist-packages/google/protobuf/descriptor.py", line 313, 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:
The text was updated successfully, but these errors were encountered: