How do I debug under PythonWin or IDLE?

I am sure this is a well know issue, so please feel free to just give a link if the answer and solution are long. I have a newly installed matplotlib installations running on Windows XP using Python 2.5.4. When I execute a simple 4 line example (copied directly from the PyPlot tutorial) in either PythonWin or IDLE, , it works fine and I terminate by right clicking on the generated figure and doing a Close. However, when I rerun the code from the IDE (makes no difference if I use PythonWin or IDLE) the figure hangs and eventually I get an abnormal exit and crash out of the IDE (in PythonWin there is a dialogue box that says “Runtime Error” in pythonwin.exe. This makes debugging in an IDE very clumsy, because I need to exit and restart it every time I run python code.

The test code is simply:

import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('Some Numbers')
plt.show()

Thanks in advance,

David Lees

Interactive mode works for me in an IDLE shell:

import matplotlib.pyplot as plt
plt.ion()
plt.plot([1,2,3])
plt.ylabel('Some Numbers')
plt.show() # You don't have to call show() in interactive mode though

Goyo

···

El jue, 08-01-2009 a las 12:09 -0600, debl2@...2440... escribió:

I am sure this is a well know issue, so please feel free to just give a
link if the answer and solution are long. I have a newly installed
matplotlib installations running on Windows XP using Python 2.5.4. When
I execute a simple 4 line example (copied directly from the PyPlot
tutorial) in either PythonWin or IDLE, , it works fine and I terminate
by right clicking on the generated figure and doing a Close. However,
when I rerun the code from the IDE (makes no difference if I use
PythonWin or IDLE) the figure hangs and eventually I get an abnormal
exit and crash out of the IDE (in PythonWin there is a dialogue box that
says “Runtime Error” in pythonwin.exe. This makes debugging in an IDE
very clumsy, because I need to exit and restart it every time I run
python code.

The test code is simply:

import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('Some Numbers')
plt.show()

Thanks in advance,

David Lees

I'm using the TKAgg backend, I guess there will be problems with other
interactive backends.

Goyo

···

El dom, 11-01-2009 a las 16:48 +0100, Goyo escribió:

El jue, 08-01-2009 a las 12:09 -0600, debl2@...2440... escribió:
> I am sure this is a well know issue, so please feel free to just give a
> link if the answer and solution are long. I have a newly installed
> matplotlib installations running on Windows XP using Python 2.5.4. When
> I execute a simple 4 line example (copied directly from the PyPlot
> tutorial) in either PythonWin or IDLE, , it works fine and I terminate
> by right clicking on the generated figure and doing a Close. However,
> when I rerun the code from the IDE (makes no difference if I use
> PythonWin or IDLE) the figure hangs and eventually I get an abnormal
> exit and crash out of the IDE (in PythonWin there is a dialogue box that
> says “Runtime Error” in pythonwin.exe. This makes debugging in an IDE
> very clumsy, because I need to exit and restart it every time I run
> python code.
>
> The test code is simply:
>
> import matplotlib.pyplot as plt
> plt.plot([1,2,3])
> plt.ylabel('Some Numbers')
> plt.show()
>
>
> Thanks in advance,
>
> David Lees

Interactive mode works for me in an IDLE shell:

import matplotlib.pyplot as plt
plt.ion()
plt.plot([1,2,3])
plt.ylabel('Some Numbers')
plt.show() # You don't have to call show() in interactive mode though

Goyo