The CVS version of ITK (http://www.itk.org/) uses CableSwig, a mixture of GCC-XML, Cable and Swig. In anycase, in the latest version, it seems that wrapped objects have a non-string attribute name:
>>> print obj._geodesicActiveContour
<C itk::SmartPointer<(itk::GeodesicActiveContourLevelSetImageFilter<(itk::Image<(float,3)>,itk::Image<(float,3)>,float)>)> instance at _b01e8b00_p_itk__SmartPointerTitk__GeodesicActiveContourLevelSetImageFilterTitk__ImageTfloat_3_t_itk__ImageTfloat_3_t_float_t_t>
>>> [a for a in dir(obj._geodesicActiveContour) if type(a) != str]
[<class 'itkGeodesicActiveContourLevelSetImageFilter.itkGeodesicActiveContourLevelSetImageFilterF3F3_PointerPtr'>]
>>>
So, when one types in this case e.g. "obj._geodesicActiveContour." PyCrust raises an exception (it's supposed to show tooltips). It seems in "introspect.py", it's using .upper() whilst sorting the attribute list. This obivously does not work on the non-string attribute. This is in wxPython 2.4.2.4.
The attached patch fixes this by removing non-string attribute names in introspect.py. Maybe this is not an issue anymore in 2.5.x?
The CVS version of ITK (http://www.itk.org/) uses CableSwig, a mixture of GCC-XML, Cable and Swig. In anycase, in the latest version, it seems that wrapped objects have a non-string attribute name:
>>> print obj._geodesicActiveContour
<C itk::SmartPointer<(itk::GeodesicActiveContourLevelSetImageFilter<(itk::Image<(float,3)>,itk::Image<(float,3)>,float)>)> instance at _b01e8b00_p_itk__SmartPointerTitk__GeodesicActiveContourLevelSetImageFilterTitk__ImageTfloat_3_t_itk__ImageTfloat_3_t_float_t_t>
>>> [a for a in dir(obj._geodesicActiveContour) if type(a) != str]
[<class 'itkGeodesicActiveContourLevelSetImageFilter.itkGeodesicActiveContourLevelSetImageFilterF3F3_PointerPtr'>]
>>>
So, when one types in this case e.g. "obj._geodesicActiveContour." PyCrust raises an exception (it's supposed to show tooltips). It seems in "introspect.py", it's using .upper() whilst sorting the attribute list. This obivously does not work on the non-string attribute. This is in wxPython 2.4.2.4.
But arn't all object attributes in Python objects supposed to have string names? Maybe I missed something but it seems like this would break a lot more than introspection if they didn't.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
So, when one types in this case e.g. "obj._geodesicActiveContour." PyCrust raises an exception (it's supposed to show tooltips). It seems in "introspect.py", it's using .upper() whilst sorting the attribute list. This obivously does not work on the non-string attribute. This is in wxPython 2.4.2.4.
But arn't all object attributes in Python objects supposed to have string names? Maybe I missed something but it seems like this would break a lot more than introspection if they didn't.
That's what I thought too, but seeing it actually being done made me doubt that. This is also relatively easy to DIY(tm):
>>> blaat = 3
>>> locals()[blaat] = 4
>>> locals()
{3: 4, 'blaat': 3, '__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', 'pywin': <module 'pywin' from 'pywin\__init__.pyc'>, '__doc__': None}
>>> meep = locals()
>>> [a for a in meep.keys() if type(a) != str]
[3]
>>>
In the light of this, maybe PyCrust should be robustified with my patch?
So, when one types in this case e.g. "obj._geodesicActiveContour." PyCrust raises an exception (it's supposed to show tooltips). It seems in "introspect.py", it's using .upper() whilst sorting the attribute list. This obivously does not work on the non-string attribute. This is in wxPython 2.4.2.4.
But arn't all object attributes in Python objects supposed to have string names? Maybe I missed something but it seems like this would break a lot more than introspection if they didn't.
That's what I thought too, but seeing it actually being done made me doubt that. This is also relatively easy to DIY(tm):
Via (abusive <wink>) dictionary manipulations yes, but can you create an item in a module or class via normal means that does not have a string name?
In the light of this, maybe PyCrust should be robustified with my patch?
Yes.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!