Bug while using python coppeliasim_zmqremoteapi_client library

Typically: "How do I... ", "How can I... " questions
Post Reply
Horizon
Posts: 6
Joined: 15 Nov 2023, 08:27

Bug while using python coppeliasim_zmqremoteapi_client library

Post by Horizon »

I'm connecting my external python controller with the coppeliasim using zmq remote api in ubuntu22.
My simple code is show below:

Code: Select all

from coppeliasim_zmqremoteapi_client import RemoteAPIClient

client = RemoteAPIClient()
sim = client.require('sim')
sim.setStepping(True)
Faceing this problem:

Code: Select all

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[2], line 2
      1 client = RemoteAPIClient()
----> 2 sim = client.require('sim')
      3 sim.setStepping(True)

File ~/anaconda3/envs/IBVS_VIC/lib/python3.8/site-packages/coppeliasim_zmqremoteapi_client/__init__.py:176, in RemoteAPIClient.require(self, name)
    174     ret = self.requiredItems[name]
    175 else:
--> 176     self.call('zmqRemoteApi.require', [name])
    177     ret = self.getObject(name)
    178 return ret

File ~/anaconda3/envs/IBVS_VIC/lib/python3.8/site-packages/coppeliasim_zmqremoteapi_client/__init__.py:150, in RemoteAPIClient.call(self, func, args)
    148 if 'err' in reply:
    149     raise Exception(reply.get('err'))  # __EXCEPTION__
--> 150 return self._process_response(reply)

File ~/anaconda3/envs/IBVS_VIC/lib/python3.8/site-packages/coppeliasim_zmqremoteapi_client/__init__.py:115, in RemoteAPIClient._process_response(self, resp)
    114 def _process_response(self, resp):
--> 115     ret = resp['ret']
    116     if len(ret) == 1:
    117         return ret[0]

KeyError: 'ret'
In the same time I have try the same code in Windows and Macos, it's right.
How can I do? Thanks for a lot!!!

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Bug while using python coppeliasim_zmqremoteapi_client library

Post by coppelia »

What version and what revision of coppeliaSim are you running? If not the latest, try to upgrade to the latest.

Also, once you have the latest version, make sure to upgrade the pip package too, e.g.:

Code: Select all

pip install --upgrade coppeliasim_zmqremoteapi_client
Cheers

Horizon
Posts: 6
Joined: 15 Nov 2023, 08:27

Re: Bug while using python coppeliasim_zmqremoteapi_client library

Post by Horizon »

I upgrade my coppeliasim to version 4.6.0 and that's alright now!
Thank you for your help!!!

Post Reply