Python gprc AttributeError: 'NoneType' object has no attribute 'message_types_by_name'
Asked Answered
P

1

6

I just want to complete a simple demo, but I got this error message.

Traceback (most recent call last):
  File "E:/grpc/biliService.py", line 10, in <module>
    import hello_bilibili_pb2 as pb2
  File "E:\grpc\hello_bilibili_pb2.py", line 21, in <module>
    _HELLODEWEIREQ = DESCRIPTOR.message_types_by_name['HelloDeweiReq']
AttributeError: 'NoneType' object has no attribute 'message_types_by_name'
Patagium answered 18/4, 2022 at 0:46 Comment(0)
W
2
grpcio==1.30.0
grpcio-tools==1.30.0

The latest grpcio version 1.44.0 generate incompatible pb2 files, so I've seen the same question, I downgrade grpcio 1.30.0, and it worked.

Wonderland answered 21/4, 2022 at 9:19 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Gash
I wasn't able to run this inside docker for these versions for some reason 🤔Frascati

© 2022 - 2024 — McMap. All rights reserved.