title: python3 pySerial TypeError: unicode strings are not supported, please encode to bytes:
body: <p>In Python 3 I imported the pySerial library so I could communicate with my Arduino Uno by serial commands.<br>
  It worked very well in Python 2.7 but in Python 3 I keep running into a error it says this </p>
  
  <blockquote>
    <p><strong><em>TypeError: unicode strings are not supported, please encode to bytes: 'allon'</em></strong> </p>
  </blockquote>
  
  <p>In Python 2.7 the only thing I did differently is use <code>raw_input</code> but I don't know what is happening in Python 3. Here is my code </p>
  
  <pre><code>import serial, time
  import tkinter
  import os
  
  def serialcmdw():
      os.system('clear')
      serialcmd = input("serial command: ")
      ser.write (serialcmd)
  
  serialcmdw()
  
  ser = serial.Serial()
  os.system('clear')
  ser.port = "/dev/cu.usbmodem4321"
  ser.baudrate = 9600
  ser.open()
  time.sleep(1)
  serialcmdw()
  </code></pre>