I'm using Python appscript to write artwork to my iTunes Songs. I have a file stored in .pict format and when I use the normal open
and read
routines, it reads the content as a string (encoded in utf-8).
imFile = open('/Users/kartikaiyer/temp.pict','r')
data = imFile.read()
it = app('iTunes')
sel = it.current_track.get()
sel.artworks[1].data_.set(data[513:])
Is the code I'm using. it fails with a objct not recognized and I'm guessing its because the set parameter is a utf-8 encoded string, Any ideas as to how I can coerce data
to a bytestream and use that as a set parameter. BinAscii module doesn't have the functions I need. Any help would be much appreciated.
Try setting the read mode to binary: