ZeroRPC and IronPython

I'd love to use the excellent zerorpc for my project that uses IronPython, but it doesn't seem to be supported.

I tried to download the zip source for zerorpc

and run

"C:\Program Files (x86)\IronPython 2.7\ipy.exe" setup.py install

      

but I can see it along the way:

warning: build_py: byte-compiling is disabled, skipping.

      

This does not contradict the answer: Fast and scalable RPC between C # and CPython .

My question (s):

  • Is it possible to run zerorpc with IronPython, and if so, can you give me a hint how to do it?
  • If not, are there any other equivalent packages that would provide functionality in IronPython? Here's a list here: What is the current choice for RPC in Python? but does anyone know if any of these work with IronPython?

Update 2 Following @PawelJasinski's suggestion and his updates for pyzmq ironpython-backend, I've tried the following:

(cooler.py):

class Cooler(object):
    """ Various convenience methods to make things cooler. """

    def add_man(self, sentence):
        """ End a sentence with ", man!" to make it sound cooler, and
        return the result. """
        return sentence + ", man!"

    def add_42(self, n):
        """ Add 42 to an integer argument to make it cooler, and return the
        result. """
        return n + 42

    def boat(self, sentence):
        """ Replace a sentence with "I'm on a boat!", and return that,
        because it cooler. """
        return "I'm on a boat!"

import zerorpc

s = zerorpc.Server(Cooler())
s.bind("tcp://0.0.0.0:4242")
s.run()

      

Now I see this error:

Traceback (most recent call last):
  File "C:\Users\nlindop\AppData\Roaming\Python\IronPython27\site-packages\zmq\backend\select.py", line 26, in select_backend
  File "C:\Users\nlindop\AppData\Roaming\Python\IronPython27\site-packages\zmq\backend\ctypes\__init__.py", line 26, in <module>
  File "C:\Users\nlindop\AppData\Roaming\Python\IronPython27\site-packages\zmq\backend\ctypes\constants.py", line 16, in <module>
ImportError: No module named ZMQ

      

+3


source to share


2 answers


ZeroRPC seems to be pure python and is based on pyzmq. In this case, you can try pyzmq ctypes

backend for IronPython. https://github.com/paweljasinski/pyzmq/tree/ironpython-backend

  • use IronPython 2.7.5b2 or newer
  • install the 32 bit version of zmq from http://zeromq.org/distro:microsoft-windows
  • install pyzmq myself, clone than ipy.exe setup.py install --user

    . The installation should detect your zmq and select the correct DLL
  • activate ctypes server, set environment variable PYZMQ_BACKEND=zmq.backend.ctypes



UPDATE: ZeroRPC has a dependency on gevent

which is not available in IronPython, so the above instructions are only valid for pyzmq under IronPython

+2


source


For the second part of the question. pyro (and its serpent dependency ) IronPython and Jython support.



Warning: avoid IronPython 2.7.5b3 - it has a bug that breaks the snake. 2.7.4 and 2.7.5b2 are ok. The next 2.7.5 has a fix.

+2


source







All Articles