Fatal Python error: deallocating None

I'm using matplotlib with Python 2.4.4 to make scatter plots of a
reasonably large dataset. Specifically about 200 plots with around
3224 points each. Unfortunately after about 30-40 plots, python
invariably crashes with the error:

Fatal Python error: deallocating None
Aborted

below is the code which is causing the crash, I've tried it with
various backends with the same results.

Any ideas how to avoid this? Many thanks in advance,

John
    for ani in range(an1, an2):
        if ba1 <= ani: ba1 = ani + 1
        for bli in range(ba1, ba2):
            if v.blank[ani, bli]:
                continue
            for chi in range(v.nch):
                plot(v.iat, v.amp[:,ani,bli,0,chi,0], ',')
                plot(v.iat, v.amp[:,ani,bli,0,chi,1], ',')
                plot(v.iat, v.amp[:,ani,bli,1,chi,0], ',')
                plot(v.iat, v.amp[:,ani,bli,1,chi,1], ',')
            title('Baseline ' + str(ani) + ',' + str(bli))
            savefig('TimeSeries' + str(ani) + '-' + str(bli))
            close()
            print 'printing baseline ' + str(ani) + '/' + str(bli)

I'm using matplotlib with Python 2.4.4 to make scatter plots of a
reasonably large dataset. Specifically about 200 plots with around
3224 points each. Unfortunately after about 30-40 plots, python
invariably crashes with the error:

Could you produce a piece of freestanding code that we can run that
reproduces the error so we can try and debug it. Unfortunately, there
is nothing obviously wrong with your code, which means it is likely to
be a bug on our side.

Also, please report your versions of matplotlib and numpy, etc. One
good way to do this is to create a simple test script and run it with

python test.py --verbose-helpful

and paste the output here.

To kickstart the process, here is a script that makes 500 figures with
a similar number of points that *does not crash* on my system. If you
are generating figures in batch, make sure you are running in a image
backend like Agg (for PNG) or PS (for postscript) ....

import matplotlib
matplotlib.use('Agg')
import numpy
import pylab
N = 3224
ind = numpy.arange(float(N))
for i in range(500):
    fig = pylab.figure()
    ax = fig.add_subplot(111)
    ax.plot(ind, numpy.random.rand(N), ',')
    ax.set_title('Baseline %d'%i)
    fig.savefig('TimeSeries %d'%i)
    pylab.close()
    print 'printing baseline ', i

Thanks,
JDH

JDH

···

On 4/13/07, John Morgan <mojoh81@...287...> wrote:

Try as I might I couldn't get your script to crash, so I modified my
code so it was more like yours (see below - I've also made some
cosmetic changes as well). It now runs without crashing :slight_smile:

If you still want to try and squash this bug I'm happy to do some more
testing but as far as I'm concerned the problem is solved.

Many thanks for the help.

Cheers,

John

PS just in case it's at all relevant, I forgot to mention that for
unrelated reasons I'm using matplotlib with numarray rather than numpy

    for ani in range(an1, an2):
        if ba1 <= ani: ba1 = ani + 1
        for bli in range(ba1, ba2):
            if v.blank[ani, bli]:
                continue
            fig = pylab.figure()
            ax = fig.add_subplot(111)
            for chi in range(v.nch):
                ax.plot(v.iat, v.amp[:,ani,bli,0,chi,0], ',')
                ax.plot(v.iat, v.amp[:,ani,bli,0,chi,1], ',')
                ax.plot(v.iat, v.amp[:,ani,bli,1,chi,0], ',')
                ax.plot(v.iat, v.amp[:,ani,bli,1,chi,1], ',')
            baseline = '%02d-%02d' % (ani, bli)
            ax.set_title('Baseline ' + baseline)
            fig.savefig('TimeSeries' + baseline)
            pylab.close()
            print 'printing baseline ' + baseline

···

On 16/04/07, John Hunter <jdh2358@...287...> wrote:

On 4/13/07, John Morgan <mojoh81@...287...> wrote:
> I'm using matplotlib with Python 2.4.4 to make scatter plots of a
> reasonably large dataset. Specifically about 200 plots with around
> 3224 points each. Unfortunately after about 30-40 plots, python
> invariably crashes with the error:
>

Could you produce a piece of freestanding code that we can run that
reproduces the error so we can try and debug it. Unfortunately, there
is nothing obviously wrong with your code, which means it is likely to
be a bug on our side.

Also, please report your versions of matplotlib and numpy, etc. One
good way to do this is to create a simple test script and run it with

> python test.py --verbose-helpful

and paste the output here.

To kickstart the process, here is a script that makes 500 figures with
a similar number of points that *does not crash* on my system. If you
are generating figures in batch, make sure you are running in a image
backend like Agg (for PNG) or PS (for postscript) ....

import matplotlib
matplotlib.use('Agg')
import numpy
import pylab
N = 3224
ind = numpy.arange(float(N))
for i in range(500):
    fig = pylab.figure()
    ax = fig.add_subplot(111)
    ax.plot(ind, numpy.random.rand(N), ',')
    ax.set_title('Baseline %d'%i)
    fig.savefig('TimeSeries %d'%i)
    pylab.close()
    print 'printing baseline ', i

Thanks,
JDH

JDH

Since we still don't know if it is even in matplotlib (it could be in
numarray) I don't think we can pursue this until we have a minimal
script which reproduces the error. If it rears up again, try and
isolate it and send us a script.

Thanks,
JDH

···

On 4/17/07, John Morgan <mojoh81@...287...> wrote:

If you still want to try and squash this bug I'm happy to do some more
testing but as far as I'm concerned the problem is solved.