GRPC Error: Parameter to MergeFrom() must be instance of same class

Viewed 1950

I have seen all previous questions about this, but nothing seems to be working on my end. I am trying to run a test that uses a protobuf generated file, called 'resource_pb2'. I am using Python 3.8 with grpc 1.33.2 and protobuf version 3.14.

When using a class from this protobuf generated file, my test fails with the following error:

Parameter to MergeFrom() must be instance of same class: expected RecognitionResource got RecognitionResource

I've checked the type and id's of all the "recognition resource" classes being called in that particular test, and I get the following:

<class 'resource_pb2.RecognitionResource'> 2069160783760
<class 'resource_pb2.RecognitionResource'> 2069160783760
<class 'resource_pb2.RecognitionResource'> 2069160783760

They are clearly all being called from the same source, so why is this issue occuring?

1 Answers

I had a similar issue and the reason was that I had made a mistake when passing parameters to the function. The problem was solved when I realized about my bug and I invoked the function in the right way, with all required parameters properly set. Hope it helps.

Related