[pywin32-bugs] [ pywin32-Bugs-3029949 ] Type information lost in enumeration of COM objects
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2010-07-19 09:32:53
|
Bugs item #3029949, was opened at 2010-07-15 14:09 Message generated for change (Comment added) made by erikjanssen You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3029949&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: com Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Erik Janssen (erikjanssen) Assigned to: Nobody/Anonymous (nobody) Summary: Type information lost in enumeration of COM objects Initial Comment: I am using the pywin32-214.win32-py2.7.exe distribution. I notice type information is not always available. In the following 3-line snippet 'SearchResult' is an enumerator of objects of a certain type'. Coding it like this everything is fine and python knows the type of f: for i in range(0,result.SearchResults.Count): f = result.SearchResults.Item(i) print f.StartTime, "-", f.EndTime, f.Camera.CameraName But in the following code, imho preffered, python complains about f being IUnknown and can't continue: for f in result.SearchResults: print f print f.StartTime, "-", f.EndTime, f.Camera.CameraName In the generated files (gencache) all information seems to be available, as in the IDL of the COM component. I can supply lot's of additional information but I don't know what is making sense and what isn't. ---------------------------------------------------------------------- Comment By: Erik Janssen (erikjanssen) Date: 2010-07-19 11:32 Message: Here is the relevant IDL, assuming that is what you refer to: 223 interface IFootageDescriptionEnumerator : IDispatch 224 { 225 [id(DISPID_NEWENUM), propget] HRESULT _NewEnum([out, retval] IUnknown** Enumerator); 226 [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT Index, [out, retval] IFootageDescription **FootageInfo); 227 [id(0x00000001), propget] HRESULT Count([out, retval] long * Count); 228 }; I notice that another enumarator works fine in python, it is in the IDL declared as: 131 interface ICameraEnumerator : IDispatch{ 132 [id(0xfffffffc), propget] HRESULT _NewEnum([out, retval] IUnknown **CameraEnum); 133 [id(00000000), propget] HRESULT Item([in] int Index, [out, retval] ICamera **CameraInfo); 134 [id(00000000), propput] HRESULT Item([in] int Index, [in] ICamera *CameraInfo); 135 [id(0x00000001), propget] HRESULT Count([out, retval] int *Count); Hope that helps. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2010-07-15 18:40 Message: Does the item have a _NewEnum method? If so, how is it defined? Otherwise I am surprised IUnknown is returned - it should behave identically to when you call Item() manually. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3029949&group_id=78018 |