[IronPython] RPyC and IronPython
ronnie.maor at gmail.com
Wed May 21 23:42:47 PDT 2008
I'm trying to use RPyC (http://rpyc.wikispaces.com), which is a great
package for "generic remote control" of remote processes.
it basically works, except for small changes I needed to make due to
outstanding IPy incompatiblities. wanted to let people know in case you also
want to use it (it's really great).
Also wanted to validate that I'm not missing something in my patches:
1) it uses sys.excepthook. I understand this isn't supported. commented it
out (it's not that critical)
2) id(obj) in IPy returns System.Int64, which unfortunately doesn't pickle
out of the box, since it's not a python native type.
even if you get it to work (using IPCE pickle fix), it won't be
compatible with CPython, and running rpyc between IPy and CPython is really
cool, and it works :-).
The patch I used is to change the affected place to long(id(obj)).
Is there a reason not to have IPy return long from id(obj)? I think
having pure python code return non python types is a problem.
3) some protocols don't work on proxies to CLR objects. The most serious is
that you can't iterate over IEnumerable objects.
After initial investigation it seems to boil down to the fact that in
IPy an IEnumerable x does the right thing when you call iter(x), but there
is no x.__iter__.
Is this allowed by the python standard, or IPy bug?
In any case I'm going to try and patch the server code to use iter(x)
instead of x.__iter__, and same for other protocols which are broken
If it doesn't work there's a trivial workaround, which is to have the
following code on the server side (in advance, or write it from the client):
def itr(x): return (i for i in x)
then you just wrap the problematic objects with itr (from the client
calls) before iterating over them. since generators do have __iter__ this
I'm also talking to the maintainer of the package, so hopefully rpyc will
work with ipy out of the box soon.
btw, forgot to mention this is all IPy 1.1.1
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users