nccgroup / blackboxprotobuf

Blackbox Protobuf is a set of tools for working with encoded Protocol Buffers (protobuf) without the matching protobuf definition.
MIT License
480 stars 82 forks source link

NameError: name 'field_tyepdef' is not defined #20

Closed iamat8080 closed 10 months ago

iamat8080 commented 1 year ago

Traceback (most recent call last): File "D:\Newfolder\PROJECT\spotify_web_api\test.py", line 20, in l, r = blackboxprotobuf.protobuf_to_json(data) File "C:\Python39\lib\site-packages\blackboxprotobuf\lib\interface.py", line 75, in protobuf_to_json value, message_type = decode_message(buf, message_type) File "C:\Python39\lib\site-packages\blackboxprotobuf\lib\interface.py", line 62, in decodemessage value, typedef, = blackboxprotobuf.lib.types.length_delim.decode_message(buf, message_type) File "C:\Python39\lib\site-packages\blackboxprotobuf\lib\types\length_delim.py", line 232, in decode_message max(map(int, field_tyepdef['alt_typedefs'].keys())) NameError: name 'field_tyepdef' is not defined

iamat8080 commented 1 year ago

it's fixed i just added in try block and used else statement but it's provide missing types image

rwinkelmaier-ncc commented 10 months ago

Hi! Sorry for the late response, I think my github notifications weren't working for a bit, but should be fixed now. I'm glad you were able to find a solution.

It looks like you're using the blackboxprotobuf pypi package, which is an older fork of this project. The bbpb package is the official package based on this repo. I've rewritten a bunch of the message parsing logic and added better testing since this, so hopefully you should encounter less bugs. Let me know if you run into the same bug with that version.