[python-win32] EnsureDispatch throwing fatal error

Tim Golden mail at timgolden.me.uk
Thu Mar 31 09:31:41 CEST 2011


On 31/03/2011 06:04, Jiawei Li wrote:
> I am running the following line of code:
>
> iTunes = win32com.client.gencache.EnsureDispatch('iTunes.Application')
>
> This results in this error:
>
> Traceback (most recent call last):
>    File "Helper.py", line 154, in <module>
>    File "win32com\client\gencache.pyo", line 529, in
> EnsureDispatch
>    File "win32com\client\__init__.pyo", line 95, in Dispatch
>    File "win32com\client\dynamic.pyo", line 104, in
> _GetGoodDispatchAndUserName
>    File "win32com\client\dynamic.pyo", line 84, in
> _GetGoodDispatch
> pywintypes.com_error: (-2147221005, 'Invalid class string',
> None, None)
>
> This is being run on a Windows 7 64-bit machine with Python 2.6,
> py2exe-0.6.9, and pywin32-214.
>
> Does anyone know the meaning of this cryptic error?

Well it's surely not that cryptic, is it?

"Invalid class string" suggests that the class string you're
using ("iTunes.Application") is invalid. Is the iTunes s/w
installed on this machine?

TJG


More information about the python-win32 mailing list