python - 类型错误 : This COM object can not automate the makepy process - please run makepy manually for this object

标签 python pandas csv xlsm

什么类型的错误?

回溯错误

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

这是我的代码

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

我正在使用PyCharm VirtualEnv

我没有找到任何解决方案,有人对此有想法吗?

注意:我如何尝试使用win32访问excel工作簿,以便能够修改它!!..

最佳答案

遇到了同样的问题,并通过关闭所有正在运行的 Excel 应用程序来解决该问题。

关于python - 类型错误 : This COM object can not automate the makepy process - please run makepy manually for this object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57030278/

相关文章:

python - 遍历字典列表并从列表中找到匹配的元素并将匹配键的值附加到 defaultdict

python - 更改DataFrame中某行的增量值

python - 在 Pandas 数据框中对重复的列 ID 进行分组

Python FFMPEG AttributeError : 'Popen' object has no attribute 'proc'

python - Selenium webdriver 的工厂模式

python - 读取大型数据集 Pandas

python - 找不到我的数据集的异常值(更具体地说是 IQR)

python - 提速生成器->列表-> Python中的CSV

python - CSV 到 Excel - 使用 Python 保留百分比

scala - 如何修复 Spark 严重误解 csv 的问题?