zerorpc module throwing error in python 2.7

512 Views Asked by At

I'm using zerorpc module to communicate between node and python.Im able to call python script from node but not getting the passed arguments in python instead getting error as "TypeError: ord() expected string of length 1, but memoryview found". node version is v4.4.5 and the python version is 2.7

python script

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

Node script

   var zerorpc = require("zerorpc");
   var server = new zerorpc.Server({
   hello: function(name, reply) {
      reply(null, "Hello, " + name);
   }
  });

  server.bind("tcp://127.0.0.1:4242");
1

There are 1 best solutions below

0
On BEST ANSWER

Its a common problem with the pure python implementation of msgpack instead of the native library binding. Double check the installation of the msgpack package:

pip install --reinstall msgpack

Feel free to try this branch from the repo to see if it helps, I know I tried working around this problem, but I don't guarantee anything: https://github.com/0rpc/zerorpc-python/tree/python3.4

(and yes, this branch is for both python>=2.6 & python>=3.4)