什么类型的错误?
回溯错误
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/