import serial
from time import sleep

ser = serial.Serial(
    port='/dev/ttyUSB0',\
    baudrate=9600,\
    parity=serial.PARITY_NONE,\
    stopbits=serial.STOPBITS_ONE,\
    bytesize=serial.EIGHTBITS,\
    #timeout=None) #doesn't work
timeout=0)

print("connected to: " + ser.portstr)

# credit to https://eli.thegreenplace.net/2009/07/30/setting-up-python-to-work-with-the-serial-port
# for a working read example
while True:
    data = ser.read(9999)
    if len(data) > 0:
#        print 'Got:', data
        print data

    sleep(0.5)
#    print 'not blocked'

ser.close()
