Ungültige Klassenzeichenfolge mit der Win32com -Bibliothek Python

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Ungültige Klassenzeichenfolge mit der Win32com -Bibliothek Python

by Anonymous » 18 Apr 2025, 01:05

Ich habe den Fluss geschrieben, um eine Excel -Anwendung zu entsenden. Ich habe die Win32 -Bibliothek in Python verwendet und Folgendes geschrieben: < /p>

import win32com.client as win32
import pywinauto

excel = win32.gencache.EnsureDispatch('Excel.Application'
< /code>

Wegen dieser Zeile habe ich diesen Fehler erhalten: < /p>

K:\venv\Scripts\python.exe K:/test_results.efrat.py
Traceback (most recent call last):
File "K:\venv\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
IDispatch = pythoncom.connect(IDispatch)
win32.types.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "K:/test_results.efrat.py", line 8, in
excel = win32.gencache.EnsureDispatch('Excel.Application')
File "K:\venv\lib\site-packages\win32com\client\gencache.py", line 527, in EnsureDispatch
disp = win32com.client.Dispatch(prog_id)
File "K:\venv\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "K:\venv\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "K:\venv\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
win32.types.com_error: (-2147221005, 'Invalid class string', None, None)

Process finished with exit code 1
< /code>

Weiß jemand, was das Problem sein könnte? Ich habe pywin32 und pypiwin32 in meinen Bibliothekspaketen installiert.

Top