ibm-dev-incubator / demoparser

Apache License 2.0
34 stars 10 forks source link

Protobuf Error #12

Closed lm82jyke closed 5 years ago

lm82jyke commented 5 years ago

when i install the newest build (0.0.1.dev23) i get an error message i couldnt resolve myself. On the version i get through installing with (pip install csgo-demoparser)(0.0.1) the demos parsed until the end with some exceptions but didnt show this error: Traceback (most recent call last): File "./parser.py", line 7, in from demoparser.demofile import DemoFile File "demoparser/demofile.pyx", line 10, in init demoparser.demofile File "/home/berta2/.local/lib/python3.5/site-packages/demoparser/protobufs/netmessages_pb2.py", line 18, in serialized_pb=' . . . ' File "/home/berta2/.local/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 878, in new return _message.default_pool.AddSerializedFile(serialized_pb) TypeError: expected bytes, str found

kpei commented 5 years ago

Try installing the latest commit. The pip version is out of date

lm82jyke commented 5 years ago

actually that only happens when i install from repository(with "pip install PATH_TO_REPO/.).... i tried the latest and some older commits but all with the same error. But when install the pip version with "pip install csgo-demoparser" the demo parses till the end. What version of python and protobuf are you using?

kpei commented 5 years ago

Python 3.6.5 and latest version of protobuf. An easy workaround is to simply install this fork (clone then setup.py install). Make sure to disable the protobuf builder in _setup_hooks.py

You can check out my fork as well which supports the latest DZ-update as well as updated protobufs.

lm82jyke commented 5 years ago

thank you very much for responding. I got it working with the fork from brunoalano/demoparser but when i install your fork i get this error message on running my script:

Traceback (most recent call last): File "parser1.py", line 7, in from demoparser.demofile import DemoFile File "demoparser/demofile.pyx", line 10, in init demoparser.demofile File "/home/berta2/.local/share/virtualenvs/py-demoparser--RtpXIIm/lib/python3.5/site-packages/demoparser/protobufs/cstrike15_usermessages_pb2.py", line 17, in import netmessages_pb2 as netmessages__pb2 ImportError: No module named 'netmessages_pb2'

do i need to compile the protobuf files again befor installing?

kpei commented 5 years ago

Yeah you will need to compile the protobuf on my fork since I put in the new protobufs from Valve. Make sure _setup_hooks.py is correctly specified before compiling. I've had success using latest protobuf compiler 3.6.1 on linux machine

lm82jyke commented 5 years ago

thanks for your help i finally got it to work. it seems like python3 has a problem with relative imports which are generated by protoc: https://github.com/protocolbuffers/protobuf/issues/1491 a workaround is to manually edit the generated files befor installing. But i wonder why it seems like im the only one having this problem.