Reputation: 2035
i try to use zerorpc python client like this:
import zerorpc
c = zerorpc.Client()
c.connect("tcp://127.0.0.1:4242")
print c.hello("RPC")
and i get this error at start
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?
Upvotes: 4
Views: 973
Reputation: 61
The docs are currently wrong. 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 it says further down in the docs.)
My CoffeeScript code that works looks like this:
zrpc = require 'zerorpc'
server = new zrpc.Server
hello: (name, reply) ->
reply null, "Hello, #{name}!"
server.bind 'tcp://0.0.0.0:4242'
Upvotes: 6