[ pywin32-Bugs-2726657 ] getting PyIUnknown for a known return typeâ
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2009-04-06 11:58:32
|
Bugs item #2726657, was opened at 2009-04-02 23:01 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2726657&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: Patricio Stegmann (kpoman) Assigned to: Nobody/Anonymous (nobody) Summary: getting PyIUnknown for a known return type Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2009-04-06 21:58 Message: Do you have any information about the API exposed by this object. Looking at: # Result is of type IAcquisitionDeviceInfo def EnumerateDevices(self): return self._ApplyTypes_(1610743823, 1, (8201, 0), (), u'EnumerateDevices', '{7ED03FE9-4DCC-4F5D-BDF8-4D4D22C1FA10}',) It seems something (maybe pywin32, maybe the object) is confused about the enumeration. A function named 'EnumerateDevices' would be expected to return a list/enum of IAcquisitionDeviceInfo's, not an IAcquisitionDeviceInfo directly, and I suspect this is the root of the problem. To confirm, adding a print to the __init__ of IAcquisitionDeviceInfo might tell you if we are trying to create such an object, but failing (presumably as we have an enum) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2726657&group_id=78018 |