[pywin32-bugs] getting PyIUnknown for a known return type
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Patricio S. <kp...@ho...> - 2009-04-02 03:21:43
|
Hello all, I am getting a strange behaviour for a generated clsid: class IAcquisitionDevice(DispatchBaseClass): # SOME CODE STRIPPED HERE # Result is of type IAcquisitionDeviceInfo def EnumerateDevices(self): return self._ApplyTypes_(1610743823, 1, (8201, 0), (), u'EnumerateDevices', '{7ED03FE9-4DCC-4F5D-BDF8-4D4D22C1FA10}',) def GetNumberOfDevices(self): return self._oleobj_.InvokeTypes(1610743822, LCID, 1, (3, 0), (),) # SOME CODE STRIPPED HERE # THEN SOME LINES LATER class IAcquisitionDeviceInfo(DispatchBaseClass): CLSID = IID('{7ED03FE9-4DCC-4F5D-BDF8-4D4D22C1FA10}') coclass_clsid = IID('{DDD89560-8B0E-4D6F-9BDF-7E14068C1DEB}') _prop_map_get_ = { "Properties": (1610743809, 2, (8, 0), (), "Properties", None), "SerialNumber": (1610743808, 2, (8, 0), (), "SerialNumber", None), } _prop_map_put_ = { } I saved all this on a mk4 file. Then I perform some tests: >>> import mk4 >>> dev = mk4.AcquisitionDevice() >>> print dev.GetNumberOfDevices() 1 >>> print dev.EnumerateDevices() (<PyIUnknown at 0x00BCB4C0 with obj at 0x0509FF90>,) >>> I dont know why I am getting a PyIUnknown if it should now I am returning IAcquisitionDevice object ! I guess there is some error somewhere and I really need to fix it. From that ActiveX documentation I see this: void EnumerateDevices (AcquisitionDeviceInfo infos[]) enumerate all connected acquisition devices So it should return an array of infos and not only one info (this array contains infos for all the different compatible devices). So somehow the python cache file got wrongly generated. How can I fix this please ? How to declare it should be an array of deviceinfos instead of a single deviceinfo ? Thank you all for any help, Patricio _________________________________________________________________ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx |