python - 如何使用 Win32Com 处理 Inkscape?
问题描述
我已成功使用 win32com 与 MS Visio 进行交互。很棒的图书馆。现在我想对 Inkscape 做同样的事情,但似乎无法在网上找到任何足够的信息。
import win32com.client
from win32com.client import constants
app = win32com.client.Dispatch(Inkscape.Application
app.Visible = 1
返回
---------------------------------------------------------------------------
com_error Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
88 try:
---> 89 IDispatch = pythoncom.connect(IDispatch)
90 except pythoncom.ole_error:
com_error: (-2147221005, 'Ungültige Klassenzeichenfolge', None, None)
During handling of the above exception, another exception occurred:
com_error Traceback (most recent call last)
<ipython-input-4-ce241241c43e> in <module>
----> 1 getVisio()
<ipython-input-3-266ab8177f92> in getVisio()
2 ''' gets a handle on the visio application.
3 sets global vApp'''
----> 4 vApp = win32com.client.Dispatch("Inkscape.Application")
5 vApp.Visible =1
6 return vApp
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\__init__.py in Dispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToString, clsctx)
93 """
94 assert UnicodeToString is None, "this is deprecated and will go away"
---> 95 dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
96 return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
97
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
112 else:
113 userName = str(userName)
--> 114 return (_GetGoodDispatch(IDispatch, clsctx), userName)
115
116 def _GetDescInvokeType(entry, invoke_type):
C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
89 IDispatch = pythoncom.connect(IDispatch)
90 except pythoncom.ole_error:
---> 91 IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
92 else:
93 # may already be a wrapped class.
com_error: (-2147221005, 'Ungültige Klassenzeichenfolge', None, None)
我不明白错误消息告诉我什么。欢迎任何提示。提前致谢。
解决方案
推荐阅读
- java - 发送带有附件的电子邮件时出错
- math - 偏离中心线旋转
- javascript - 画布Javascript中的随机扩展圆圈
- string - 如何在源代码中跨多行编写单行字符串文字
- c++ - C++ diff 是非类
- kubernetes-helm - 我可以从 helm hooks 运行的脚本中检索出来并将其用作另一个图表的输入吗?
- asp.net - ASP.NET MVC OpenId 与 Ajax 混合
- questdb - 如何使用 Python 将流入线路协议记录写入 QuestDB?
- html - 如何调整切换按钮的大小?
- hyperledger-fabric - 网关编程模型是新常态吗?