Python 2.7 Mac上的zerorpc python hello world客户端不工作
我尝试像这样使用zerorpc python客户端:Python 2.7 Mac上的zerorpc python hello world客户端不工作,python-2.7,zeromq,Python 2.7,Zeromq,我尝试像这样使用zerorpc python客户端: import zerorpc c = zerorpc.Client() c.connect("tcp://127.0.0.1:4242") print c.hello("RPC") zrpc = require 'zerorpc' server = new zrpc.Server hello: (name, reply) -> reply null, "Hello, #{name}!" server.bind 'tcp:
import zerorpc
c = zerorpc.Client()
c.connect("tcp://127.0.0.1:4242")
print c.hello("RPC")
zrpc = require 'zerorpc'
server = new zrpc.Server
hello: (name, reply) ->
reply null, "Hello, #{name}!"
server.bind 'tcp://0.0.0.0:4242'
我一开始就发现了这个错误
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)
回溯(最近一次呼叫最后一次):
文件“/Programming/python/snmp01/snmp01.py”,第34行,在
打印c.hello(“RPC”)
文件“/Library/Python/2.7/site packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py”,第256行,在
返回lambda*args,**kargs:self(方法,*args,**kargs)
文件“/Library/Python/2.7/site packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py”,第241行,在调用中__
返回self.\u进程\u响应(请求\u事件、bufchan、超时)
文件“/Library/Python/2.7/site packages/zerorpc-0.4.3-py2.7.egg/zerorpc/core.py”,第225行,进程响应中
提升
zerorpc.exceptions.RemoteError:错误:你好,RPC
在服务器上。_recv.result(//Programming/node/snmp01/node_modules/zerorpc/lib/Server.js:146:55)
有什么想法吗?他们现在错了。如果节点端没有错误,则需要将null
作为第一个参数传递给reply
。第一个参数是错误(如文档中进一步所述)
我的咖啡脚本代码如下所示:
import zerorpc
c = zerorpc.Client()
c.connect("tcp://127.0.0.1:4242")
print c.hello("RPC")
zrpc = require 'zerorpc'
server = new zrpc.Server
hello: (name, reply) ->
reply null, "Hello, #{name}!"
server.bind 'tcp://0.0.0.0:4242'
你能分享nodejs服务器的代码吗,这样我们就可以重现这个问题了?你有一个相反的例子吗?(python服务器和node.js客户端)UGH。可笑的是,官方消息来源两年来一直大错特错。