1

I want to display matplotlib figures in another python process.

My idea is to use a python module that acts as a proxy between the calling python process and the remote python process (I say remote but I am mostly interested in another process on the local machine). So basically doing RPC. For example I would do:

from mplproxy import pyplot as plt

plt.plot(range(10)) # this will call matplotlib.pyplot.plot in the remote process
plt.show() # same here

I figured that IPython Notebook has just that kind of behavior so there might be something there that I can use. Actually I found this SO post which lead me to think I could do this using the IPython package:

Connecting to a remote IPython instance

Using this information I managed to connect to a remote IPython kernel and execute simple shell commands, but I wonder how should the data (method arguments) be transfered? For example: if I wrap a function like

def my_function(*args, **kwargs):
    transmit(args)
    transmit(kwargs)
    shell_channel.execute('my_function(args,kwargs)')

how should args and kwargs be transmitted over before I can call the function remotely?

Or maybe there is an easier way to accomplish this?

Community
  • 1
  • 1
gdm
  • 96
  • 3
  • The IPython notebook isn't really doing RPC - the client side just deals with code strings and displayed output. Only the kernel, where code runs, deals with Python objects. IPython does have an RPC mechanism in IPython.parallel, but it's probably not what you want to use here. Have a look at [Pyro4](https://pythonhosted.org/Pyro4/). – Thomas K Jul 09 '14 at 17:00

0 Answers0