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:
- IronPython 2.7.5b2 or newer installed
- Installed 32 bit version of zeromq from http://zeromq.org/distro:microsoft-windows
- Debug
ironpython-backend
from https://github.com/paweljasinski/pyzmq/tree/ironpython-backend - In
pyzmq
dir runipy.exe setup.py install --user
- Clone zerorpc from https://github.com/dotcloud/zerorpc-python
- In
zerorpc-python
runipy.exe setup.py install --user
- Set the environment variable:
set PYZMQ_BACKEND=zmq.backend.ctypes
- Trying to use the example of the "Cooler" class from https://github.com/dotcloud/zerorpc-python working with
ipy.exe -X:Frames cooler.py
(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
source to share
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
source to share
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.
source to share