Hi,

I originally and mistakenly posted this on the win32 list, so  
apologies if its been seen already.

I'm working with some ESRI com libraries (9.0). I've managed to  
retrieve an ILayer from an IMap and then cast IFeatureLayer from the  
ILayer.

feature = layer.QueryInterface 
(comtypes.gen.esriGeoDatabase.IFeatureLayer)

Now, what I want to get is the FeatureClass property of the feature.  
So, I do:

feature.FeatureClass

and this yields:

<bound method POINTER(IFeatureLayer).FeatureClass of <POINTER 
(IFeatureLayer) object cbc990>>

And

feature.FeatureClass()

yields:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: required argument 'fclass' missing

fclass needs to be a pointer to an IFeatureClass whose CoClass,  
FeatureClass, is a non-creatable COM class.


Other properties seem to work. For example,

feature.DataSourceType

returns

u'Personal Geodatabase Feature Class'

I'm not sure if matters but the relevant parts of feature._methods_ are:

(<class 'ctypes.HRESULT'>, '_get_FeatureClass', (<class  
'ctypes.LP_POINTER(IFeatureClass)'>,), ((10, 'fclass'),), ('propget',  
u"The layer's feature class."), u" The layer's feature class.")

(<class 'ctypes.HRESULT'>, 'FeatureClass', (<class 'comtypes.POINTER 
(IFeatureClass)'>,), ((1, 'fclass'),), ('propputref', u"The layer's  
feature class."), u"The layer's feature class.")

(<class 'ctypes.HRESULT'>, '_get_DataSourceType', (<class  
'ctypes.LP_BSTR'>,), ((10, 'Text'),), ('propget', u'Data source  
type.'), u'Data source type.')

(<class 'ctypes.HRESULT'>, '_set_DataSourceType', (<class  
'comtypes.BSTR'>,), ((1, 'Text'),), ('propput', u'Data source  
type.'), u'Data source type.')

If I call

feature._get_FeatureClass() directly, I get a runtime error:

...
  File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line  
202, in __getattr__
     return getattr(self, name)
RuntimeError: maximum recursion depth exceeded


Lastly, feature.FeatureClass works fine in VB, for what that's worth.  
Comtypes has been really useful in working with the esri libraries,  
so any help would be really appreciated.

thanks very much,

Nick


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to