title: Not able to read complete data from serial port in python
body: <p>i am reading cat /proc/kmsg continuously in a loop through serial port.When the no.of bytes  in serial buffer is zero ,i am breaking the loop.</p>
  
  <p>But i am not able to read complete data from the buffer.Some data is missing.How 
  can i read complete data without any loss??</p>
  
  <pre><code>    import serial
      ser1=serial.Serial('COM67')
      ser.baudrate=115200
      resp=[]
      ser1.write("cat /proc/kmsg\n")   
      cnt=0
      time.sleep(1)
      while True:
          bytesToRead = ser1.inWaiting()
          c=ser1.read(bytesToRead)
          ser1.flushInput()
          import re
          c=re.sub(r'\x08','',c)
          resp.append(c)            
          if(bytesToRead==0):
              cnt=cnt+1
              if(cnt&gt;5):
                  print "-"*57
                  ser1.write("\x03")        #'\x03' ==CTRL+C
                  break
      ser1.flushInput()
      print "_kmsg data :",resp
  </code></pre>