← Back to team overview

yade-users team mailing list archive

Re: [Question #138108]: issues with plotting (maybe due to matplotlib)

 

Hi,

Try to print the data you want to plot on the terminal, you may have
some voids with 'none' values. Python can't handle it !

Nejib

Le vendredi 17 décembre 2010 à 12:48 +0000, Giulia Macaro a écrit :
> New question #138108 on Yade:
> https://answers.launchpad.net/yade/+question/138108
> 
> Hi,
> 
> I'm using yade-bzr2612 on ubuntu 9.10. The plot window crashes at some point almost in every simulation, regardless the simulation it's running.
> 
> When it happens in the terminal I got:
> 
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (550, 0))
> 
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (550, 0))
> 
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (550, 0))
> 
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (550, 0))
> 
> ---------------------------------------------------------------------------
> KeyError                                  Traceback (most recent call last)
> 
> /usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4.pyc in mouseReleaseEvent(self, event)
>     134         y = self.figure.bbox.height - event.y()
>     135         button = self.buttond[event.button()]
> --> 136         FigureCanvasBase.button_release_event( self, x, y, button )
>     137         if DEBUG: print 'button released'
>     138 
> 
> /usr/lib/pymodules/python2.6/matplotlib/backend_bases.pyc in button_release_event(self, x, y, button, guiEvent)
>    1217         s = 'button_release_event'
>    1218         event = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent)
> -> 1219         self.callbacks.process(s, event)
>    1220         self._button = None
>    1221 
> 
> 
> 
> 
> ...and continues with something similar for other a while (do you need the whole output?)... and then:
> 
> KeyError: (0.0, 0.00019999999999999987, u'0.0002', 'k', 'center', 'right', 7623432979757281113, None, 80, 79854408)
> 
> 
> At this point I close the window plot (with the simulation still running), and open it again with the F8 command. Sometimes it works, sometimes I got:
> 
> 
> 
> RuntimeError                              Traceback (most recent call last)
> 
> /home/giulia/YADE/lib/yade-bzr2612/py/yade/__init__.pyc in <module>()
> ----> 1 
>       2 
>       3 
>       4 
>       5 
> 
> /home/giulia/YADE/lib/yade-bzr2612/py/yade/plot.pyc in plot(noShow, subPlots)
>     254         .. note:: For backwards compatibility reasons, *noShow* option will return list of figures for multiple figures but a single figure (rather than list with 1 element) if there is only 1 figure.
>     255 	"""
> --> 256         createPlots(subPlots=subPlots)
>     257         global currLineRefs
>     258         if not noShow:
> 
> /home/giulia/YADE/lib/yade-bzr2612/py/yade/plot.pyc in createPlots(subPlots)
>     148         global currLineRefs
>     149         figs=set([l.line.get_axes().get_figure() for l in currLineRefs]) # get all current figures
> --> 150         for f in figs: pylab.close(f) # close those
>     151         currLineRefs=[] # remove older plots (breaks live updates of windows that are still open)
>     152         if len(plots)==0: return # nothing to plot
> 
> /usr/lib/pymodules/python2.6/matplotlib/pyplot.pyc in close(*args)
>     334                 if manager.canvas.figure==arg:
>     335                     manager.canvas.mpl_disconnect(manager._cidgcf)
> --> 336                     _pylab_helpers.Gcf.destroy(manager.num)
>     337         else:
>     338             raise TypeError('Unrecognized argument type %s to close'%type(arg))
> 
> /usr/lib/pymodules/python2.6/matplotlib/_pylab_helpers.pyc in destroy(num)
>      61         del Gcf.figs[num]
>      62         #print len(Gcf.figs.keys()), len(Gcf._activeQue)
> 
> ---> 63         figManager.destroy()
>      64         gc.collect()
>      65 
> 
> /usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4.pyc in destroy(self, *args)
>     278         self.window._destroying = True
>     279         QtCore.QObject.disconnect( self.window, QtCore.SIGNAL( 'destroyed()' ),
> --> 280                                    self._widgetclosed )
>     281         if self.toolbar: self.toolbar.destroy()
>     282         if DEBUG: print "destroy figure manager"
> 
> RuntimeError: underlying C/C++ object has been deleted
> 
> 
> 
> 
> Could it be related to the python version (Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) 
> [GCC 4.4.1] on linux2) I'm using?
> or do I need any other python package?
> 
> It's not that I can't run the simulation as it works now, but it's a bit annoying.
> 
> Thank you
> Giulia
> 
> 
> 
> 
> 




Follow ups

References