I'm getting an odd error while playing with iTunes. Here's a simplified version of the code:
-- import win32com.client def main(): for track_index, track in tracks(): print track_index, repr(track.Artist), repr(track.Album), repr(track.Name), track.PlayedCount, print track.PlayedDate def tracks(playlist=None): iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application") if playlist: library = iTunes.LibrarySource.Playlists.ItemByName(playlist) else: library = iTunes.LibraryPlaylist track_collection = library.Tracks track_count = track_collection.Count for track_index in range(1, track_count+1): yield track_index, track_collection.Item(track_index) if __name__ == '__main__': main() -- This fails when printing the 'PlayedDate' of a track that has never been played. Which is fair enough. up to a point, but I don't get an exception as I'd expect. (Well, *half* expect - a None would ne nice!) Instead, it just falls over with the following dialog: --------------------------- python.exe - Application Error --------------------------- The instruction at "0x1e606cf2" referenced memory at "0x00000000". The memory could not be "read". Click on OK to terminate the program Click on CANCEL to debug the program --------------------------- OK Cancel --------------------------- Debugging tells me: --------------------------- Microsoft Visual C++ --------------------------- Unhandled exception in python.exe (PYWINTYPES23.DLL): 0xC0000005: Access Violation. --------------------------- OK --------------------------- Any ideas? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ _______________________________________________ Python-win32 mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-win32