title: Read data through RS232 from a device (Displacement measurement) with Python
body: <p>I've a displacemente measurement and I want that Python give me the values, but I do not know, How receive the data.I use this code, and give me the following error - TypeError: can't concat bytes to str.</p>
  
  <pre><code>`import serial
  
  port = "COM3"
  baud = 115200
  
  ser = serial.Serial(port, baud, timeout=1)
  
      # open the serial port
  if ser.isOpen():
       print(ser.name + ' is open...')
  
  while True:
      cmd = input("Enter command or 'exit':")
          # for Python 2
      # cmd = input("Enter command or 'exit':")
          # for Python 3
      if cmd == 'exit':
          ser.close()
          exit()
      else:
          ser.write(cmd.encode('ascii','strict')+'\r\n')
          out = ser.read()
          print('Receiving...'+out)
  
  `
  </code></pre>