[Osgeo4w-trac] [osgeo4w] #213: Qt4Agg backend broken in matplotlib
OSGeo4W
trac_osgeo4w at osgeo.org
Mon Feb 28 05:54:17 EST 2011
#213: Qt4Agg backend broken in matplotlib
---------------------+------------------------------------------------------
Reporter: goyodiaz | Owner: osgeo4w-dev@…
Type: defect | Status: new
Priority: major | Component: Package
Version: | Keywords:
---------------------+------------------------------------------------------
{{{
D:\>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib as mpl
>>> mpl.use('Qt4Agg')
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 2])
[<matplotlib.lines.Line2D object at 0x0180FB90>]
>>> plt.show()
Traceback (most recent call last):
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_q
t4.py", line 168, in resizeEvent
self.draw()
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_q
t4agg.py", line 130, in draw
FigureCanvasAgg.draw(self)
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 313, in draw
self.renderer = self.get_renderer()
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 319, in get_renderer
try: self._lastKey, self.renderer
TypeError: 'sip.methoddescriptor' object is not callable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_q
t4.py", line 69, in show
figManager.canvas.draw()
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_q
t4agg.py", line 130, in draw
FigureCanvasAgg.draw(self)
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 313, in draw
self.renderer = self.get_renderer()
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 319, in get_renderer
try: self._lastKey, self.renderer
TypeError: 'sip.methoddescriptor' object is not callable
>>> Traceback (most recent call last):
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_q
t4agg.py", line 83, in paintEvent
FigureCanvasAgg.draw(self)
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 313, in draw
self.renderer = self.get_renderer()
File "D:\OSGeo4w\apps\Python25\lib\site-
packages\matplotlib\backends\backend_a
gg.py", line 319, in get_renderer
try: self._lastKey, self.renderer
TypeError: 'sip.methoddescriptor' object is not callable
}}}
The offending line is testing for attributes existence. The next line
catches AttributeError but now a TypeError is raised. Catching TypeError
in line 320 seems to solve this.
Before:
{{{
try: self._lastKey, self.renderer
except AttributeError: need_new_renderer = True
else: need_new_renderer = (self._lastKey != key)
}}}
After
{{{
try: self._lastKey, self.renderer
except (AttributeError, TypeError): need_new_renderer = True
else: need_new_renderer = (self._lastKey != key)
}}}
--
Ticket URL: <http://trac.osgeo.org/osgeo4w/ticket/213>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer for the OSGeo stack.
More information about the Osgeo4w-trac
mailing list