Update: The functions that don't work return Record types, and the ones that do work just return multiple values (a tuple). Do I need to pass in the appropriate Record type (or an empty record) during each function call? If so, how do I get to the Record types that I see in the python object browser (python -m win32com.client.combrowse)?
Thanks, Terry On Mon, Jan 27, 2020 at 3:33 PM Terry Davis <terry.y.da...@gmail.com> wrote: > Hi all, > > I tried searching the mailing list archives for "com_record" but didn't > find anything relevant. > > For context, I'm trying to access a COM interface defined in a .tlb file. > > Here's a skeleton of the script I'm using to expose this interface: > import pythoncom > from win32com.client import gencache > > lib_GUID = "{<GUID>}" > lib_major = 1 > lib_minor = 0 > lib_pyITypelib = pythoncom.LoadRegTypeLib(lib_GUID, lib_major, lib_minor) > lib = gencache.EnsureModuleForTypelibInterface(_lib_pyITypelib) > > ccs = lib.CControlServer() # CControlServer is a CoClass > eid, *other = ccs.LoadExperiment(**path to file**) # Works > ccs.GetSoftwareInfo() # Fails with exception below. > ccs.GetSolvent(eid) # also fails > > I can't dig down in the debugger to find the source of the exception, so > I'm hoping someone here can help! > > > Exception: > > def GetSoftwareInfo(self, info=pythoncom.Missing): > > > <ipython-input-8-7304ad54d54a> in <module> > ----> 1 ccs.GetSoftwareInfo() > > ~\AppData\Local\Temp\gen_py\3.7\<GUID>x0x1x0.py in GetSoftwareInfo(self, > info) > 279 def GetSoftwareInfo(self, info=pythoncom.Missing): > 280 'method GetSoftwareInfo' > --> 281 return self._ApplyTypes_(13, 1, (24, 0), ((36, > 2),), 'GetSoftwareInfo', None,info > 282 ) > 283 > > C:\Python37\lib\site-packages\win32com\client\__init__.py in > _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, > *args) > 465 def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, > user, resultCLSID, *args): > 466 return self._get_good_object_( > --> 467 self._oleobj_.InvokeTypes(dispid, 0, > wFlags, retType, argTypes, *args), > 468 user, resultCLSID) > 469 > > TypeError: Only com_record objects can be used as records >
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32