From: Mike K. <mbk...@gm...> - 2009-04-07 05:43:51
|
I'm running 0.6.0 under Python 2.6. Source code: *********************************************************************** from comtypes import * from comtypes.client import * import comtypes.gen.iTunesLib itunes = CreateObject("iTunes.Application") librarySource = itunes.LibrarySource playListCollection = librarySource.Playlists userPlayList = playListCollection.ItemByName("My Test PlayList") if userPlayList is None: userPlayList = itunes.CreatePlaylist("My Test PlayList") print userPlayList u2 = cast(userPlayList, POINTER(comtypes.gen.iTunesLib.IITUserPlaylist)) print u2 u2.Reveal() *********************************************************************** This fails with the following output: <POINTER(IITPlaylist) ptr=0x2a5a24 at 1ee1940> <POINTER(IITUserPlaylist) ptr=0x2a5a24 at 1ee18a0> --------------------------------------------------------------------------- WindowsError Traceback (most recent call last) e:\projects\Python\FetchAudio\aftp.py in <module>() 49 print u2 50 ---> 51 u2.Reveal() 52 WindowsError: exception: access violation reading 0x00000000 *********************************************************************** I'm trying to do something equivalent the following, which works using win32com.client: u2 = win32com.client.CastTo(userPlayList, 'IITUserPlaylist') It's as if the downcast is failing. Please advise. Thanks, Mike |