Phoenix - ProcessIdle not available

Hi,

I see this exception (or similar, i.e. always the same attribute error but the traceback starts at a different place).

This is with: 2.9.5.81-r73873

If I use "2.9.5.0.b20130318" with the same script it runs fine.

BaseApp is:
class BaseApp(wx.App, InspectionMixin):

Any hint on where to look as debugging in WingIDE throughs me all kind of errors when I try to step through.

Werner

AttributeError: 'BaseApp' object has no attribute 'ProcessIdle'
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 863, in <module>
   apprb = Appstats(None, standalone=True)
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 204, in __init__
   self.setupControls()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 237, in setupControls
   self.createStatsPanes()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 367, in createStatsPanes
   self.paneStatsCtryPurVal.axes = self.paneStatsCtryPurVal.figure.add_subplot(noRow, noCol, 1)
File "c:\Python27\Lib\site-packages\matplotlib\figure.py", line 882, in add_subplot
   a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 8938, in __init__
   self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 472, in __init__
   self.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 860, in cla
   spine.cla()
File "c:\Python27\Lib\site-packages\matplotlib\spines.py", line 157, in cla
   self.axis.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 732, in cla
   self.reset_ticks()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 746, in reset_ticks
   self.minorTicks.extend([self._get_tick(major=False)])
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 1839, in _get_tick
   return YTick(self.axes, 0, '', major=major, **tick_kw)
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 141, in __init__
   self.gridline = self._get_gridline()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 552, in _get_gridline
   alpha=rcParams['grid.alpha'],
File "c:\Python27\Lib\site-packages\matplotlib\lines.py", line 222, in __init__
   self._yorig = np.asarray([])
File "c:\Python27\Lib\site-packages\numpy\core\numeric.py", line 235, in asarray
   return array(a, dtype, copy=False, order=order)

BTW, I tried without WIT, but still the same.

Werner

···

On 28/04/2013 11:49, Werner wrote:

Hi,

I see this exception (or similar, i.e. always the same attribute error but the traceback starts at a different place).

This is with: 2.9.5.81-r73873

If I use "2.9.5.0.b20130318" with the same script it runs fine.

BaseApp is:
class BaseApp(wx.App, InspectionMixin):

werner wrote:

Hi,

I see this exception (or similar, i.e. always the same attribute error
but the traceback starts at a different place).

This is with: 2.9.5.81-r73873

If I use "2.9.5.0.b20130318" with the same script it runs fine.

BaseApp is:
class BaseApp(wx.App, InspectionMixin):

BTW, I tried without WIT, but still the same.

Is there any more to that traceback? I don't see where the call to ProcessIdle is coming from.

This is another case of a method not being documented, and so Phoenix is not seeing it. Although there still is a ProcessIdle in the C++ wxApp, it and some other event loop related methods are now implemented (and documented) in the wxEventLoop class so that is probably what should be used now. You may try replacing the call to self.ProcessIdle() (assuming self is the app object) with:

     self.GetMainLoop().ProcessIdle()

or maybe:

     wx.EventLoop.GetActive().ProcessIdle()

···

On 28/04/2013 11:49, Werner wrote:

--
Robin Dunn
Software Craftsman

...

Is there any more to that traceback? I don't see where the call to ProcessIdle is coming from.

That was it, I'll give you another one below.

This only happens in my code when I use matplotlib stuff - it doesn't happen when I use the simple wxembedded sample to test.

There is no call to ProcessIdle in my code and the one time where I see it in matplotlib it is commented out, but instead they call wx.WakeUpIdle()

I see in FigureCanvasWx in matplotlib they are using a timer in "draw_idle" which in turn calls _onDrawIdle which uses wx.GetApp().Pending which I can only find in 2.8 wx doc and not in 2.9.5 nor Phoenix.

Werner

P.S.
Below two tracebacks I get from the same script just by restarting it.

Start my script with matplot figures in WingIDE:
AttributeError: 'BaseApp' object has no attribute 'ProcessIdle'
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 863, in <module>
   apprb = Appstats(None, standalone=True)
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 204, in __init__
   self.setupControls()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 237, in setupControls
   self.createStatsPanes()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 374, in createStatsPanes
   self.paneStatsRegionBlt.axes = self.paneStatsRegionBlt.figure.add_subplot(noRow, noCol, 1)
File "c:\Python27\Lib\site-packages\matplotlib\figure.py", line 882, in add_subplot
   a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 8938, in __init__
   self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 461, in __init__
   self._init_axis()
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 521, in _init_axis
   self.yaxis = maxis.YAxis(self)
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 651, in __init__
   self.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 732, in cla
   self.reset_ticks()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 745, in reset_ticks
   self.majorTicks.extend([self._get_tick(major=True)])
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 1839, in _get_tick
   return YTick(self.axes, 0, '', major=major, **tick_kw)
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 139, in __init__
   self.tick1line = self._get_tick1line()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 524, in _get_tick1line
   zorder=self._zorder,
File "c:\Python27\Lib\site-packages\matplotlib\lines.py", line 209, in __init__
   self.set_fillstyle(fillstyle)
File "c:\Python27\Lib\site-packages\matplotlib\lines.py", line 321, in set_fillstyle
   self._marker.set_fillstyle(fs)
File "c:\Python27\Lib\site-packages\matplotlib\markers.py", line 150, in set_fillstyle
   self._recache()
File "c:\Python27\Lib\site-packages\matplotlib\markers.py", line 127, in _recache
   self._path = Path(np.empty((0,2)))
File "c:\Python27\Lib\site-packages\matplotlib\path.py", line 116, in __init__
   vertices = np.asarray(vertices, np.float_)
File "c:\Python27\Lib\site-packages\numpy\core\numeric.py", line 235, in asarray
   return array(a, dtype, copy=False, order=order)

Restart the same script:
AttributeError: 'BaseApp' object has no attribute 'ProcessIdle'
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 863, in <module>
   apprb = Appstats(None, standalone=True)
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 204, in __init__
   self.setupControls()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 237, in setupControls
   self.createStatsPanes()
File "c:\dev\twcbv4\twcbsrc\controllers\app_stats.py", line 409, in createStatsPanes
   self.paneStatsDtypePaC.axes = self.paneStatsDtypePaC.figure.add_subplot(noRow, noCol, 1)
File "c:\Python27\Lib\site-packages\matplotlib\figure.py", line 882, in add_subplot
   a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 8938, in __init__
   self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 472, in __init__
   self.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 860, in cla
   spine.cla()
File "c:\Python27\Lib\site-packages\matplotlib\spines.py", line 157, in cla
   self.axis.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 732, in cla
   self.reset_ticks()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 745, in reset_ticks
   self.majorTicks.extend([self._get_tick(major=True)])
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 1839, in _get_tick
   return YTick(self.axes, 0, '', major=major, **tick_kw)
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 140, in __init__
   self.tick2line = self._get_tick2line()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 541, in _get_tick2line
   l.set_transform(self.axes.get_yaxis_transform(which='tick2'))
File "c:\Python27\Lib\site-packages\matplotlib\axes.py", line 681, in get_yaxis_transform
   return self.spines['right'].get_spine_transform()
File "c:\Python27\Lib\site-packages\matplotlib\spines.py", line 374, in get_spine_transform
   self._ensure_position_is_set()
File "c:\Python27\Lib\site-packages\matplotlib\spines.py", line 140, in _ensure_position_is_set
   self.set_position(self._position)
File "c:\Python27\Lib\site-packages\matplotlib\spines.py", line 365, in set_position
   self.axis.cla()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 732, in cla
   self.reset_ticks()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 745, in reset_ticks
   self.majorTicks.extend([self._get_tick(major=True)])
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 1839, in _get_tick
   return YTick(self.axes, 0, '', major=major, **tick_kw)
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 139, in __init__
   self.tick1line = self._get_tick1line()
File "c:\Python27\Lib\site-packages\matplotlib\axis.py", line 524, in _get_tick1line
   zorder=self._zorder,
File "c:\Python27\Lib\site-packages\matplotlib\lines.py", line 209, in __init__
   self.set_fillstyle(fillstyle)
File "c:\Python27\Lib\site-packages\matplotlib\lines.py", line 321, in set_fillstyle
   self._marker.set_fillstyle(fs)
File "c:\Python27\Lib\site-packages\matplotlib\markers.py", line 150, in set_fillstyle
   self._recache()
File "c:\Python27\Lib\site-packages\matplotlib\markers.py", line 135, in _recache
   self._marker_function()
File "c:\Python27\Lib\site-packages\matplotlib\markers.py", line 593, in _set_tickright
   self._transform = Affine2D().scale(1.0, 1.0)
File "c:\Python27\Lib\site-packages\matplotlib\transforms.py", line 1834, in scale
   self.invalidate()
File "c:\Python27\Lib\site-packages\matplotlib\transforms.py", line 131, in invalidate
   return self._invalidate_internal(value, invalidating_node=self)
File "c:\Python27\Lib\site-packages\matplotlib\transforms.py", line 153, in _invalidate_internal
   for parent in self._parents.itervalues():
File "c:\Python27\Lib\weakref.py", line 147, in itervalues
   for wr in self.data.itervalues():

···

On 30/04/2013 06:29, Robin Dunn wrote:

This is another case of a method not being documented, and so Phoenix is not seeing it. Although there still is a ProcessIdle in the C++ wxApp, it and some other event loop related methods are now implemented (and documented) in the wxEventLoop class so that is probably what should be used now. You may try replacing the call to self.ProcessIdle() (assuming self is the app object) with:

    self.GetMainLoop().ProcessIdle()

or maybe:

    wx.EventLoop.GetActive().ProcessIdle()