1.1.1rc RuntimeError: underlying C/C++ object has been deleted

qt-x11-4.8.0-7.fc16.x86_64
PyQt4-4.8.6-1.fc16.x86_64

But interestingly, I'm not actually using the display in this script. I'm using
pdfpages.

The basic outline is:
At the start:

        from matplotlib.backends.backend_pdf import PdfPages
        self.pdf = PdfPages(file_name)

Then at the start of each page I do:
        self.prop = mpl.font_manager.FontProperties(size='xx-small')

        self.fig = fig = plt.figure()
        self.ax = fig.add_subplot(111)
        fig.subplots_adjust(bottom=0.2)
        self.colors = itertools.cycle(['r','g','b','c','y','m','k'])
        self.markers = itertools.cycle(['o','s','v'])

Then at the start of each plot on a page I do:
        
  self.ax.semilogy (esno, [e for e in per], c=self.colors.next(),
marker=self.markers.next(), label='iter=%s'%n_iter)

Finally, to finish each page:

        plt.title (...)
        plt.grid(which='major', linestyle='solid')
        plt.grid(which='minor', linestyle='dashed')
        plt.legend(prop=self.prop, loc='best')
        self.ax.set_xlabel ('${E_s}/N_0$')
        self.ax.set_ylabel ('per')
        plt.figtext (0, 0, res['carriers'].values, horizontalalignment='left',
verticalalignment='bottom', size=5)
        self.pdf.savefig (self.fig)
        plt.close()

Then when all pages are done:
        self.pdf.close()

It looks like I'm getting one of these error messages for each page.

Michael Droettboom wrote:

···

Can you provide more detail about how to reproduce this?

I can deduce you're using the Qt4Agg backend -- but running
simple_plot.py, zooming around, and then closing the window does not
seem to reproduce the error here.

What version of Qt/PyQt/PySide are you running. What platform?

Mike

On 03/28/2012 08:34 AM, Neal Becker wrote:

I'm getting these messages, which did not occur with 1.1:

Traceback (most recent call last):
   File "/home/nbecker/.local/lib/python2.7/site-
packages/matplotlib/backends/backend_qt4.py", line 151, in<lambda>
     lambda: self.close_event())
   File "/home/nbecker/.local/lib/python2.7/site-
packages/matplotlib/backend_bases.py", line 1564, in close_event
     self.callbacks.process(s, event)
RuntimeError: underlying C/C++ object has been deleted

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

This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure

At the beginning of your script (before importing pylab/pyplot) you should be doing

import matplotlib

matplotlib.use(‘pdf’)

It looks like you are inadvertently importing the qt library in a headless script run.

JDH

···

On Wed, Mar 28, 2012 at 8:57 AM, Neal Becker <ndbecker2@…149…> wrote:

qt-x11-4.8.0-7.fc16.x86_64

PyQt4-4.8.6-1.fc16.x86_64

But interestingly, I’m not actually using the display in this script. I’m using

pdfpages.