From: Benjamin R. <ben...@ou...> - 2012-05-05 19:51:58
|
On Saturday, May 5, 2012, Tony Yu wrote: > I'm getting a strange error when multiple figures are created *without a > call to show*. Here's the traceback: > > Traceback (most recent call last): > File > "/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_qt4.py", line > 151, in <lambda> > lambda: self.close_event()) > File "/Users/Tony/python/devel/mpl/lib/matplotlib/backend_bases.py", > line 1564, in close_event > self.callbacks.process(s, event) > AttributeError: 'FigureCanvasQTAgg' object has no attribute 'callbacks' > > > Here's a simple test case: > > import matplotlib.pyplot as plt > fig = plt.figure() > plt.plot([0, 1]) > fig = plt.figure() > plt.plot([0, 1]) > > > This issue appears in versions after the PR to fix the Qt4 close bug<https://github.com/matplotlib/matplotlib/pull/716>. > The error occurs even without the `plot` calls, but the failures aren't as > consistent (the error will randomly disappear). > > Note that sticking a call to `plt.show()` at the end and then manually > closing the figures does not seem to produce this error. I'm having a > difficult time locating the source of the bug: when I stick a pdb trace in > the code, the error doesn't get raised. > > Can anyone reproduce this issue? > > -Tony > My gut tells me it is a race condition. Pdb can make race conditions disappear because of all the overhead screws around with the timings. Haven't tried reproducing it yet, though. Ben Root |