matplotlib in interactive mode locks when run from subprocess
Almar Klein
almar.klein at gmail.com
Thu Sep 18 10:13:59 EDT 2008
Hi,
In wxpython, I made an interactive shell, which creates a remote python
subprocess
to do the interpreting. Communication is done via a pipe. The idea is that
the python
session is an actual process separate from the GUI, which has some
advantages,
like I can have multiple such shells in my application, and I can kill them
without
worrying that my wx app will crash.
To do this I use the wx.Process class, which allows asynchronous
communication with
the remote process.
This all works really, I will also launch wxpython apps. So I was quite
happy, untill I tried
doing some plotting with matplotlib (in TkAgg backend). The problem is that
the process
becomes unresponsive when I plot something (No prompt is written to the
stdout/stderr).
(more details below)
I don't know much about creating subprocess and how they are different from
a normal
process. So can anyone offer some help as to what the problem might be?
Thanks in advance,
Almar
To get to the details:
- When I start a process with command "python -u -i"
-- When interactive mode is off, the whole process becomes unresponsive
when doing
pylab.show()
-- When interactive mode in on, on doing pylab.plot(), a figure appears,
which I can
zoom etc., but the process is now stuck, also after closing the figure
- When I start a process with command
"python -u -c 'import code;code.interact(readfunc=raw_input)'" (This is
how Pype does it).
-- When interactive mode is off, the figures show when doing pylab.show()
and the process
behaves as normal after closing the figure(s).
-- When interactive mode in on, on doing pylab.plot(), a figure appears,
but most of the time
it is not drawn and emmediately unresponsive, just like the process
itself.
I have also tried an asynchronous Popen recipe by Joshiah Carlson I found on
activestate. And I made my own process class using
win32process.CreateProcess.
Both alternatives to wx.Process resulted in the same sympoms.
Oh, and I run windows.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080918/7c31fa34/attachment.html>
More information about the Python-list
mailing list