pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

Type not correctly derived Py36

Open jwasys opened this issue 8 years ago • 3 comments

With py27:

displaywindow_names = self.com_object.DisplayWindowNames() print(displaywindow_names)

yields:

<win32com.gen_py.ES Vision 3.3 Type Library.IStringCollection instance at 0x58593888>

With py36 and py35:

<win32com.gen_py.None.StringCollection>

When I do:

_oleobj_ = displaywindow_names._oleobj_.QueryInterface(STRINGCOLLECTION_CLSID, pythoncom.IID_IDispatch) displaywindow_names= win32com.client.CastTo(displaywindow_names, 'IStringCollection') displaywindow_names._oleobj_ = _oleobj_

I get a working object I can iterate.

Maybe related to

https://sourceforge.net/p/pywin32/bugs/549/

Thank you for your consideration

jwasys avatar Jan 09 '18 10:01 jwasys

If looking at the strings probably you have a generated or gen_py wrapper in your cache in Python 2.7 while this is not available in Python 3.6. Look into [PythonRoot]\Lib\site-packages\win32com\gen_py or %TEMP%\gen_py if there is a difference.

sschukat avatar Jan 10 '18 07:01 sschukat

Thank you for your response sschukat.

Yes it was not available in Py35, either in [Py35Root]\Lib\site-packages\win32com\gen_py or %TEMP%\gen_py\Py35. Running makepy created it in <[Py35Root]\Lib\site-packages\win32com\gen_py> but the problem persists.

What can I do to debug this ? Where can I read up on this ? Googled quite a bit already.

Thanks,

Arian

jwasys avatar Jan 10 '18 08:01 jwasys

Linked issue is now https://github.com/mhammond/pywin32/issues/549

Avasam avatar Mar 27 '24 17:03 Avasam