Hi there,
who ever might be interested:
openchat + some code analysis helped to find the solution:
def generate_typelib(appCOMclass:str) ->None:
""" generate_typelib - generate typelib if not pre-generated as required
by COM wrapper (dynamic dispatch does not work) Args: appCOMclass (str):
ProgID / COM class of Microsoft Office host application """ try:
# get TypeInfo typeinfo =
win32com.client.Dispatch(appCOMclass)._oleobj_.GetTypeInfo(0)
# extract the TypeLib and index typelib,index
=typeinfo.GetContainingTypeLib()
# get the TypeLib attributes typelib_attr =typelib.GetLibAttr()
# generate module
win32com.client.gencache.EnsureModule(typelib_attr[0],typelib_attr[1],typelib_attr[3],typelib_attr[3])
print(f"Successfully generated the makepy module for TypeLibCLSID
{typelib_attr[0]}belonging to ProgID / COM class '{appCOMclass}'.")
except Exception as e:
print(f"Error during generation of makepy module for TypeLibCLSID
{typelib_attr[0]}belonging to ProgID / COM class '{appCOMclass}': {e}")
BTW: while I am pretty impressed by what AI namely chatGPT delivers with
regard to Python code snippets, it is quite a bit away from being flawless.
Regards
Chris
Am 27.10.2025 um 09:00 schrieb Christoph J. Dorner via python-win32:
Hi there,
after some investigation I found the issue: the new version of PyWin32
does not find the makepy generated Python module.
So I also learned that my codes needs this pre-generated. I am afraid
I had a lack of understanding how PyWin32 and COM work i e the
difference between make-py-generated dispatch and a dynamic dispatch.
So I need to initiate the makepy generation - but here comes my next
problem: I work with an objext xxx.Application i. e.
Excel.Application. However, the CLISD of this object is not the CLSID
of the respective typelib and I would need this to initiate makepy for
the typelib.
Regards
Christoph
Am 26.10.2025 um 15:36 schrieb Christoph J. Dorner via python-win32:
Hi there,
I discovered that an MSOffice wrapper, especially an EXCEL wrapper
does not work as I was used to anymore. I evaluated the COM-object
(or its _dispobj_ subobject) attributes _prop_map_get_ and
_prop_map_put. It seems they are gone. Instead there is a subobject
_olerepr_ with attributes propMapGet / propMapPut. However, these are
lazily evaluated i. e. this doesn't work as desired either.
I recently upgraded to PyWin32 3.11 - not sure what I used before, a
pretty early 3.0x release at least.
Was there a change I am not aware of?
Regards
Christoph
_______________________________________________
python-win32 mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-win32.python.org
Member address: [email protected]
_______________________________________________
python-win32 mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-win32.python.org
Member address: [email protected]
_______________________________________________
python-win32 mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-win32.python.org
Member address: [email protected]