Emacs Python-inferior shell not showing prompt after matplotlib show() command
Question: So I've been experimenting with numpy and matplotlib and have stumbled across
some bug when running python from the emacs inferior shell.

When I send the py file to the shell interpreter I can run commands after the
code executed. The command prompt ">>>" appears fine. However, after I invoke
a matplotlib show command on a plot the shell just hangs with the command
prompt not showing.

    
    
    >>> plt.plot(x,u_k[1,:]);
    [<matplotlib.lines.Line2D object at 0x0000000004A9A358>]
    >>> plt.show();
    

I am running the traditional C-python implementation. under emacs 23.3 with
Fabian Gallina's Python python.el v. 0.23.1 on Win7.

A similar question has been raised here under the i-python platform: [running
matplotlib or enthought.mayavi.mlab from a py-shell inside emacs on
windows](http://stackoverflow.com/questions/4701607/running-matplotlib-or-
enthought-mayavi-mlab-from-a-py-shell-inside-emacs-on-wind)

**UPDATE: I have duplicated the problem on a fresh instalation of Win 7 x64
with the typical python 2.7.2 binaries available from the python website and
with numpy 1.6.1 and matplotlib 1.1.0 on emacs 23.3 and 23.4 for Windows.**

There must be a bug somewhere in the emacs shell.


Answer: I think there are two ways to do it.

  1. Use ipython. Then you can use `-pylab` option. I don't use Fabian Gallina's python.el, but I guess you will need something like this:
    
        (setq python-shell-interpreter-args "-pylab")
    

Please read the documentation of python.el.

  2. You can manually activate interactive mode by [ion](http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion)
    
        >>> from matplotlib import pyplot as plt
    >>> plt.ion()
    >>> plt.plot([1,2,3])
    [<matplotlib.lines.Line2D object at 0x20711d0>]
    >>>
    

