title: Converting Exception to a string in Python 3
body: <p>does anyone have an idea, why this Python 3.2 code </p>
  
  <pre><code>try:    
      raise Exception('X')
  except Exception as e:
      print("Error {0}".format(str(e)))
  </code></pre>
  
  <p>works without problem (apart of unicode encoding in windows shell :/),
  but this </p>
  
  <pre><code>try:    
      raise Exception('X')
  except Exception as e:
      print("Error {0}".format(str(e, encoding = 'utf-8')))
  </code></pre>
  
  <p>throws <em>TypeError: coercing to str: need bytes, bytearray or buffer-like object, Exception found</em> ?</p>
  
  <p>How to convert an Error to a string with custom encoding?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>It does not works either, if there is  \u2019 in message:</p>
  
  <pre><code>try:    
      raise Exception(msg)
  except Exception as e:
      b = bytes(str(e), encoding = 'utf-8')
      print("Error {0}".format(str(b, encoding = 'utf-8')))
  </code></pre>
  
  <p>But why cannot str() convert an exception internally to bytes?</p>