You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I appear to be having issues with the GRPC client in Python with the latest updates.
PI is built with ./configure --with-bmv2 --with-proto --with-cli --with-sysrepo and the python libraries generated have been installed on the host.
ERROR:root:Exception iterating requests!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/grpc/_channel.py", line 184, in consume_request_iterator
request = next(request_iterator)
TypeError: StreamMessageRequest object is not an iterator
Is there somewhere I'm going wrong, or is there a fault in the way the code is being generated? I've tried rebuilding on 2 machines, both on Ubuntu 16.04LTS with latest updates applied
The text was updated successfully, but these errors were encountered:
This is not how the gRPC client API works for bi-directional streams (see https://grpc.io/docs/tutorials/basic/python.html). The StreamChannel method takes an iterator as a parameter and returns an iterator.
You can use something like this:
def request():
yield stream_message_request
for response in client_stub.StreamChannel(request()):
print response
However this won't work in this specific case because the StreamChannel stream on which you send the arbitration method is supposed to stay open while you send Write RPC requests. See here for a working example: https://github.com/p4lang/PI/blob/master/proto/ptf/base_test.py#L230. I used Python thread-safe queues to store requests and responses and I created a new thread to wait for responses.
Hi all,
I appear to be having issues with the GRPC client in Python with the latest updates.
PI is built with
./configure --with-bmv2 --with-proto --with-cli --with-sysrepo
and the python libraries generated have been installed on the host.The code I'm using is as follows:
The error message I get is:
Is there somewhere I'm going wrong, or is there a fault in the way the code is being generated? I've tried rebuilding on 2 machines, both on Ubuntu 16.04LTS with latest updates applied
The text was updated successfully, but these errors were encountered: