From: Neal B. <ndb...@gm...> - 2012-03-28 12:34:39
|
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 |
From: Michael D. <md...@st...> - 2012-03-28 13:35:22
|
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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel |
From: Neal B. <ndb...@gm...> - 2012-03-28 13:58:19
|
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 >> Mat...@li... >> 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 |
From: John H. <jd...@gm...> - 2012-03-28 15:19:53
|
On Wed, Mar 28, 2012 at 8:57 AM, Neal Becker <ndb...@gm...> 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. 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 |
From: Neal B. <ndb...@gm...> - 2012-03-28 18:22:21
|
John Hunter wrote: > On Wed, Mar 28, 2012 at 8:57 AM, Neal Becker > <ndb...@gm...> 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. > > > 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 Thanks, but should that cause a (scary looking) error? Or is there a real problem? |
From: John H. <jd...@gm...> - 2012-03-28 18:37:08
|
On Wed, Mar 28, 2012 at 1:22 PM, Neal Becker <ndb...@gm...> wrote: > > > import matplotlib > > matplotlib.use('pdf') > > > > It looks like you are inadvertently importing the qt library in a > headless > > script run. > > > > JDH > > Thanks, but should that cause a (scary looking) error? Or is there a real > problem? > > > It's just a clean up error in the qt destructors I think. You are basically in an unsupported use case: using a gui backend, but not raising the figures with show, so our initialization code doesn't get run properly, which means the clean up may not be properly configured. Our work is hard enough supporting all the GUI toolkits across multiple operating systems -- I don't know that we want to get into trying to support *unsupported* use cases. JDH |
From: Benjamin R. <ben...@ou...> - 2012-04-04 00:34:00
|
On Wed, Mar 28, 2012 at 2:36 PM, John Hunter <jd...@gm...> wrote: > > > On Wed, Mar 28, 2012 at 1:22 PM, Neal Becker <ndb...@gm...> wrote: > >> >> > import matplotlib >> > matplotlib.use('pdf') >> > >> > It looks like you are inadvertently importing the qt library in a >> headless >> > script run. >> > >> > JDH >> >> Thanks, but should that cause a (scary looking) error? Or is there a real >> problem? >> >> >> It's just a clean up error in the qt destructors I think. You are > basically in an unsupported use case: using a gui backend, but not raising > the figures with show, so our initialization code doesn't get run properly, > which means the clean up may not be properly configured. Our work is hard > enough supporting all the GUI toolkits across multiple operating systems -- > I don't know that we want to get into trying to support *unsupported* use > cases. > > JDH > > True that this is probably an unsupported use-case, but I don't see it as a totally unreasonable one. For example, in many of my scripts in one of my projects, I have command-line options to determine if I am going to save the figure to a file and another option to determine if I am going to show the figure as well. I could run these scripts with or without showing a figure. By the time I process the command-line arguments, I have already imported matplotlib. Of course, it isn't very difficult to recode it to import and select a backend according to the command-line arguments, it would be a more convoluted script that way. Note, I have not noticed any issues with this approach while using TkAgg and GTKAgg. I guess it could probably be made into a low-priority TODO item in PyQt4 to see if the destructor is being over-zealous. Neal, your best bet would be to file a wishlist item and tag it as such. Again, low priority, but maybe someone will notice something obvious at a later time. Cheers! Ben Root |