title: Typeerror: Unicode strings are not supported, please encode to bytes: 'ÿ'
body: <p>I have found this code (<a href="https://drive.google.com/open?id=1TGuTPjfiV4r7ra_5eLMkbXBnesYlvTyT" rel="nofollow noreferrer">https://drive.google.com/open?id=1TGuTPjfiV4r7ra_5eLMkbXBnesYlvTyT</a>) written by Adafruit (and modified by me to add in a few extra features which work in python 2.7, when I try to run the code in python 3 to make it easier to develop (as I haven't looked at much python 2 before) it gives me the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/pi/Forecast-Printer/forecast.py", line 55, in &lt;module&gt;
      printer = Adafruit_Thermal("/dev/serial0", 19200, timeout=5)
    File "/home/pi/Forecast-Printer/Adafruit_Thermal.py", line 95, in __init__
      self.wake()
    File "/home/pi/Forecast-Printer/Adafruit_Thermal.py", line 605, in wake
      self.writeBytes(255)
    File "/home/pi/Forecast-Printer/Adafruit_Thermal.py", line 189, in writeBytes
      super(Adafruit_Thermal, self).write(chr(arg))
    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 518, in write
      d = to_bytes(data)
    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes
      raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
  TypeError: unicode strings are not supported, please encode to bytes: 'ÿ'
  </code></pre>
  
  <p>The code is run on a raspberry pi running raspbian (GUI version) and it needs to be run with <code>sudo</code> as it communicates with the mini thermal printer via serial.</p>
  
  <p>Thanks in advance for any help :)</p>
  
  <p>edit:
  Here is some code that triggers the same error when run in python 3:</p>
  
  <pre><code>from Adafruit_Thermal import *
  
  printer = Adafruit_Thermal("/dev/serial0", 19200, timeout=5)    
  </code></pre>