title: python: TypeError: can't write unicode to binary stream
body: <p>I have the following code:</p>
  
  <pre><code>file = io.open(tFile,'wb') 
  if cData != '':
      file.write('%s\n' % (cData))
  </code></pre>
  
  <p>where cData is a string. The code works fine on Linux and Windows, but fails on all Solaris machines I have with the error:</p>
  
  <blockquote>
    <p>File "/usr/local/lib/python2.6/io.py", line 1045, in write
        raise TypeError("can't write unicode to binary stream") 
    TypeError: can't write unicode to binary stream</p>
  </blockquote>
  
  <p>What's wrong here? thanks</p>