title: How to read data from serial port? Python
body: <p>Hi please bear my basic question as I am new to python. <br>
  I am trying to read data from serial port. Basically serial port is a USB port converted to serial port virtually. I am using arduino. <br>
  First i tried this code:<br></p>
  
  <pre><code>while(True):
      ser=serial.Serial('COM6',9600)
      bytoread=ser.inWaiting()
      val=ser.read(bytoread)
  </code></pre>
  
  <p>But it gave me error.</p>
  
  <pre><code>Permission Error(13,Access is denied, none 5)
  </code></pre>
  
  <p>But when i changed my code to</p>
  
  <pre><code>while(True):
      ser=serial.Serial()
      ser.baudrate=19600
      ser.port='COM6'
      ser
      ser.open()
      bytoread=ser.inWaiting()
      val=ser.read(bytoread)
  </code></pre>
  
  <p>Permission error did not come but program is always busy connecting the port. I waited for many minutes but it never moved forward. What I am doing wrong here?</p>