Python TypeError:此COM对象无法自动执行makepy过程-请为此对象手动运行makepy
这种错误是什么 回溯错误Python TypeError:此COM对象无法自动执行makepy过程-请为此对象手动运行makepy,python,pandas,csv,xlsm,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\gencach
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
我正在使用PyCharm
VirtualEnv
我没有找到任何解决办法,有人知道吗
注意:我如何尝试使用win32访问
excel
工作手册,以便能够修改它 > P>您必须考虑从虚拟环境运行代码。
并卸载环境外的任何其他pywin32模块
试试看 遇到了相同的问题,请通过关闭所有正在运行的Excel应用程序来解决。我最近遇到了相同的问题。在任务管理器中终止EXCEL进程。
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')