Reputation: 1086
I'm using Python 2.7.3 and Node.js 0.10.37 in Ubuntu 12.04 and using zerorpc to invoke python from node js.. My python runs at port 9004 and node client listens to 9004 port. While invoking a method in python from Node js i'm getting the error below:
ERROR:zerorpc.channel:zerorpc.ChannelMultiplexer ignoring error on recv
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/zerorpc/channel.py", line 79, in _channel_dispatcher
event = self._events.recv()
File "/usr/local/lib/python2.7/dist-packages/zerorpc/events.py", line 341, in recv
event = Event.unpack(get_pyzmq_frame_buffer(blob))
File "/usr/local/lib/python2.7/dist-packages/zerorpc/events.py", line 198, in unpack
unpacked_msg = unpacker.unpack()
File "/usr/local/lib/python2.7/dist-packages/msgpack/fallback.py", line 570, in unpack
ret = self._fb_unpack(EX_CONSTRUCT, write_bytes)
File "/usr/local/lib/python2.7/dist-packages/msgpack/fallback.py", line 498, in _fb_unpack
typ, n, obj = self._read_header(execute, write_bytes)
File "/usr/local/lib/python2.7/dist-packages/msgpack/fallback.py", line 347, in _read_header
b = ord(c)
TypeError: ord() expected string of length 1, but memoryview found
My Node.js client side code:
var express = require('express');
var zerorpc = require('zerorpc');
var router = express.Router();
var client = new zerorpc.Client({timeout:30, heartbeatInterval:30000});
client.connect("tcp://0.0.0.0:9004");
router.post('/validateUser/', function(req, res, next){
var user_name = req.body.user_name;
client.invoke("validate_user", user_name, function(request, response, more){
res.send(response);
});
});
My Python code:
import zerorpc
class User():
def validate_user(self, user_name):
print user_name
if __name__ == "__main__":
obj = User()
s = zerorpc.Server(obj)
s.bind("tcp://0.0.0.0:9004")
s.run()
Even the print statement in python is not getting executed.
I tried uninstalling and reinstalling zerorpc and zmq. But still the same error, the same code was working in a different Ubuntu machine with same architecture.
Upvotes: 0
Views: 676