benhodgson / protobuf-to-dict

A small Python library for creating dicts from protocol buffers. Useful as an intermediate step before serialization (e.g. to JSON).
Other
226 stars 108 forks source link

name 'long' is not defined #20

Open sunclb opened 3 years ago

sunclb commented 3 years ago

python 3.8 install from pip, run import encounter name 'long' is not defined error

from protobuf_to_dict import protobuf_to_dict NameError Traceback (most recent call last)

in ----> 1 from protobuf_to_dict import protobuf_to_dict ~/miniconda3/envs/UDL-rtwr/lib/python3.8/site-packages/protobuf_to_dict.py in 13 FieldDescriptor.TYPE_FLOAT: float, 14 FieldDescriptor.TYPE_INT32: int, ---> 15 FieldDescriptor.TYPE_INT64: long, 16 FieldDescriptor.TYPE_UINT32: int, 17 FieldDescriptor.TYPE_UINT64: long, NameError: name 'long' is not defined
brucebookman commented 3 years ago

yep, see same thing... please fix

brucebookman commented 3 years ago

BTW - if i comment all the long in the map, i get name 'unicode' is not defined

StupidArthur commented 3 years ago

if sys.version_info > (3, 0): long, unicode, basestring = int, str, str

szulcmaciej commented 3 years ago

A working solution to this problem is mentioned in another issue: https://github.com/benhodgson/protobuf-to-dict/issues/15#issuecomment-368152202