title: Python 3 non-blocking read with pySerial (Cannot get pySerial's "in_waiting" property to work)
body: <p>For the life of me, I cannot figure out how to do a non-blocking serial read in Python 3 using my Raspberry Pi.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>import serial #for pySerial
  
  ser = serial.Serial('/dev/ttyUSB0', 9600) #open serial port
  print ('serial port = ' + ser.name) #print the port used
  
  while (True):
      if (ser.in_waiting&gt;0):
          ser.read(ser.in_waiting)
  </code></pre>
  
  <p>Result:<br>
  <code>AttributeError: 'Serial' object has no attribute 'in_waiting'</code></p>
  
  <p>Here's the reference page I'm referencing that told me "in_waiting" exists: <a href="http://pyserial.readthedocs.io/en/latest/pyserial_api.html" rel="nofollow noreferrer">http://pyserial.readthedocs.io/en/latest/pyserial_api.html</a></p>
  
  <h1>(Update) Related:</h1>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/17553543/pyserial-non-blocking-read-loop/38758773#38758773">PySerial non-blocking read loop</a></li>
  </ol>