pythonpandascsvxlsm

TypeError: This COM object can not automate the makepy process - please run makepy manually for this object


What this kind of error?

Traceback error

C:\Users\DELL\PycharmProjects\MyNew\venv\Scripts\python.exe 
C:/Users/DELL/PycharmProjects/MyNew/agaaaaain.py
Traceback (most recent call last):
  File "C:\Users\DELL\PycharmProjects\MyNew\venv\lib\site- 
packages\win32com\client\gencache.py", line 530, in EnsureDispatch
    ti = disp._oleobj_.GetTypeInfo()
pywintypes.com_error: (-2147418111, 'Call was rejected by callee.', None, 
None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/DELL/PycharmProjects/MyNew/agaaaaain.py", line 3, in 
<module>
excel = win32.gencache.EnsureDispatch('Excel.Application')
 File "C:\Users\DELL\PycharmProjects\MyNew\venv\lib\site- 
packages\win32com\client\gencache.py", line 541, in EnsureDispatch
raise TypeError("This COM object can not automate the makepy process - 
please run makepy manually for this object")
TypeError: This COM object can not automate the makepy process - please run 
makepy manually for this object

Process finished with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/DELL/PycharmProjects/MyNew/agaaaaain.py", line 3, in 
<module>
excel = win32.gencache.EnsureDispatch('Excel.Application')
  File "C:\Users\DELL\PycharmProjects\MyNew\venv\lib\site- 
packages\win32com\client\gencache.py", line 541, in EnsureDispatch
    raise TypeError("This COM object can not automate the makepy process - 
please run makepy manually for this object")
TypeError: This COM object can not automate the makepy process - please run 
makepy manually for this object

and this is my code

import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')

I am using PyCharm VirtualEnv

I didn't find any solution, any one have idea about this?

Note:How ever I am trying to use win32 to access excel work book, as to able for modifying it!!..


Solution

  • You must consider running the code from a Virtual Environment.

    And uninstall any other pywin32 module outside the Environment.

    Give it a shot!