title: Reading bytestreams in Python
body: <p>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 <code>open</code> and <code>read</code> routines, it reads the content as a string (encoded in utf-8).</p>
  <pre><code>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:])
  </code></pre>
  <p>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 <code>data</code> 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.</p>