pywintypes.com_error使用mlab

时间:2015-08-06 16:40:25

标签: python matlab win32com pythoncom python-mlab mlab

我想用mlab从python调用matlab。 当我做以下

from mlab.releases import R2012a as matlab

我收到以下错误:

Exception AssertionError: AssertionError() in <bound method MlabWrap.__del__ of <mlab.mlabwrap.MlabWrap object at 0x000000000A7AC9B0>> ignored
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\lib\site-packages\mlab\releases.py", line 125, in __getattr__
return self.instances[name]
  File "C:\Anaconda\lib\site-packages\mlab\releases.py", line 63, in __getitem__
self[k] = self.get_mlab_instance(k)
  File "C:\Anaconda\lib\site-packages\mlab\releases.py", line 87, in get_mlab_instance
instance = MlabWrap()
  File "C:\Anaconda\lib\site-packages\mlab\mlabwrap.py", line 405, in __init__
self._session = mlabraw.open()
  File "C:\Anaconda\lib\site-packages\mlab\mlabraw.py", line 44, in open
ret.open()
  File "C:\Anaconda\lib\site-packages\mlab\matlabcom.py", line 62, in open
self.client = win32com.client.Dispatch('matlab.application')
  File "C:\Anaconda\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Anaconda\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Anaconda\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221008, 'CoInitialize wurde nicht aufgerufen.', None, None)

最后显示的错误在德语中表示'CoInitialize未被调用'。 我不知道该怎么做。任何帮助追踪错误都将非常感激。

编辑:我在Windows 7 64位上安装了MATLAB R2012a 64位。

0 个答案:

没有答案