title: Python String cannot be converted to an integer
body: <p>I'm trying to read a sensor value from an Arduino Serial Port using the following Python script:</p>
  
  <pre><code>import serial
  ser = serial.Serial("COM5", baudrate=9600, timeout=1)
  def get_val():
      ser.write(b'g')
      return ser.readline().decode().rstrip()
  
  while 1:
      data = get_val()
      print(data)
  </code></pre>
  
  <p>So far everything works very well, python prints the sensor values on the console as strings. But when I try to cast the String 'data' to an integer, I get the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "[...] requestDataPoint.py", line 18, in &lt;module&gt;
      print(int(data))
  ValueError: invalid literal for int() with base 10: ''
  </code></pre>
  
  <p>What's wrong here? </p>