Hi all,
after help and discussions with John, I'm putting up AS ALPHA CODE, a small
script which will load ipython in a multithreaded mode which allows it to run
GTK gui apps, and in particular matplotlib with the GTK backends.
Please note that using this requires at the moment _both_ CVS ipython and CVS
matplotlib, since John and I have worked in conjunction to make the necessary
changes.
The code already works fairly well, with one significant caveat: any process
started via os.system() (whether directly or implicitly using !cmd) will hang
after a while. I have currently no solution for this, but will welcome any
ideas. Note that the problem seems to only affect long-running GUI apps,
simple '!grep foo *' type things appear to function just fine. But something
like '!gv foo.eps &' will open gv, and after about 30 seconds the gv instance
stops responding to all keyboard/mouse input.
Debugging multithreaded code is _very_ tricky, but this tool may prove useful
to many who want the interactive convenience of ipython combined with the
better matplotlib backends, or other GTK apps. All feedback from willing
testers will be very welcome.
Note that those wanting to use matplotlib interactively, and willng to stick
to the Tk backends, can already do so. Tk does not require manual threading
control, so it works perfectly OK with normal ipython. John already posted in
the past a 'pylab' ipython profile which loads and configures matplotlib for
such use, I can repost it if necessary.
This will become part of ipython 0.6.3, but I want to try to resolve the
os.system() deadlock first. Since both John and I are complete ignoramuses on
threading issues, help from anyone with knowledge on the topic is most welcome.
If you don't want to update to CVS ipython/matplotlib but think you may have
an idea, you can use this small shell for tests:
http://amath.colorado.edu/faculty/fperez/tmp/pyint-gtk.py
It provides a basic multithreaded shell as a standalone python script (no
matplotlib or ipython needed), and will show the os.system() deadlock problem.
Many thanks in advance for any feedback, and to John for all the help on this.
We (I assume I speak for both John and I here :) hope you all find it useful.
Best,
f
|