saving png under XP crashes ...

Hi all,

I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
but when I try to save a plot under Windows as a png file, the program
crashes (pdf works fine).

This is the short script I am running:

···

-------------

import pylab as plt

plt.grid(True)

# plot a point
x = 1.5
y = 0.7
plt.plot([x], [y], 'ro')

plt.show()
#plt.savefig('plot_point2.pdf')
plt.savefig('plot_point2.png')

--------------

Win XP Prof, SP 2. Downloaded maptplotlib 0.98.5.3 today along with
numpy 1.3.0 (running Python 2.6.1).

Can someone else reproduce this problem? Is this a known problem?

Thanks,
Esmail

I don't have a windows box to test on today (I can try tomorrow from
work). Most likely, you have a problem of an install over an old
install. Try installing mpl and numpy cleanly by removing all the
numpy* and matplotlib* files from your site-packages dir and
reinstalling. See also

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#matplotlib-install-location
http://matplotlib.sourceforge.net/faq/installing_faq.html#cleanly-rebuild-and-reinstall-everything

JDH

···

On Mon, May 25, 2009 at 12:32 PM, Esmail <ebonak@...32...> wrote:

Hi all,

I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
but when I try to save a plot under Windows as a png file, the program
crashes (pdf works fine).

Hello John,

\John Hunter wrote:

Hi all,

I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
but when I try to save a plot under Windows as a png file, the program
crashes (pdf works fine).

I don't have a windows box to test on today (I can try tomorrow from
work).

That would be helpful.

Most likely, you have a problem of an install over an old
install. Try installing mpl and numpy cleanly by removing all the
numpy* and matplotlib* files from your site-packages dir and
reinstalling.

I didnt' have either of those packages installed before, so that
should not be a problem, but I will take a look at the links you
sent.

Thanks .. it'll be interesting to see if the problem can be
reproduced.

Esmail

···

On Mon, May 25, 2009 at 12:32 PM, Esmail <ebonak@...32...> wrote:

One thing I just noticed -- you call show before savefig. show is
supposed to be the last line in your script, and should only be called
once. Does moving it to the end help?

JDH

···

On Mon, May 25, 2009 at 1:01 PM, Esmail <ebonak@...32...> wrote:

Hello John,

\John Hunter wrote:

On Mon, May 25, 2009 at 12:32 PM, Esmail <ebonak@...32...> wrote:

Hi all,

I'm new to pylab/matplotlib, so perhaps I am making a mistake here,
but when I try to save a plot under Windows as a png file, the program
crashes (pdf works fine).

I don't have a windows box to test on today (I can try tomorrow from
work).

That would be helpful.

Most likely, you have a problem of an install over an old
install. Try installing mpl and numpy cleanly by removing all the
numpy* and matplotlib* files from your site-packages dir and
reinstalling.

I didnt' have either of those packages installed before, so that
should not be a problem, but I will take a look at the links you
sent.

Thanks .. it'll be interesting to see if the problem can be
reproduced.

Hi again,

John Hunter wrote:

One thing I just noticed -- you call show before savefig. show is
supposed to be the last line in your script, and should only be called
once. Does moving it to the end help?

No, that's just an artifact of my trying a number of things :slight_smile:

for the pdf file save it makes no difference (but I tried both ways).

In the case of the png it always crashes, though it does create a zero-byte
file with the correct name.

Esmail