mhammond / pywin32

Python for Windows (pywin32) Extensions
4.92k stars 786 forks source link

Package requests running makepy process manually even after creating gencache of COM object #2093

Open buckeyeelectrical opened 11 months ago

buckeyeelectrical commented 11 months ago

Environment: Windows 11, Python v3.10 virtual environment in PyCharm, and pywin32 v304.

Problem: I was trying to dispatch a COM object with Events. Even after manually running the makepy process and creating the gencache of the COM object, it was still requesting I run the makepy process manually.

Solution: In /win32com/client/ init.py", I modified line 312 from:

    disp = Dispatch(clsid)

to:

    resultCLSID = pywintypes.IID(clsid)
    disp = Dispatch(clsid, resultCLSID=resultCLSID)