Zerorpc python hello world client on mac not working

I am trying to use zerorpc python client as follows:

import zerorpc c = zerorpc.Client() c.connect("tcp://127.0.0.1:4242") print c.hello("RPC") 

and I get this error on startup

 Traceback (most recent call last): File "/Programming/python/snmp01/snmp01.py", line 34, in <module> print c.hello("RPC") File "/Library/Python/2.7/site-packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py", line 256, in <lambda> return lambda *args, **kargs: self(method, *args, **kargs) File "/Library/Python/2.7/site-packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py", line 241, in __call__ return self._process_response(request_event, bufchan, timeout) File "/Library/Python/2.7/site-packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py", line 225, in _process_response raise zerorpc.exceptions.RemoteError: Error: Hello, RPC at Server._recv.result (//Programming/node/snmp01/node_modules/zerorpc/lib/server.js:146:55) 

any idea?

+4
source share
1 answer

docs are currently erroneous. If there is no error on the node side, you need to pass null as the first argument to reply . The first argument is for errors (as discussed later in the docs).

My CoffeeScript code that works is as follows:

 zrpc = require 'zerorpc' server = new zrpc.Server hello: (name, reply) -> reply null, "Hello, #{name}!" server.bind 'tcp://0.0.0.0:4242' 
+6
source

Source: https://habr.com/ru/post/1485667/


All Articles