title: PySerial Throwing 'NoneType' Exception During read()
body: <p>I am using PySerial to read incoming bytes from a serial port into a buffer.  Every time I call my read function this exception gets thrown. </p>
  
  <pre class="lang-none prettyprint-override"><code>Exception in thread Thread-2:
  Traceback (most recent call last):  
    File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner  
      self.run()
    File "C:\Python27\lib\threading.py", line 754, in run  
      self.__target(*self.__args, **self.__kwargs)
    File "gatewayTester.py", line 480, in mcuRead  
      byteIn = mcuPort.read()
    File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 269, in read   
      win32.ResetEvent(self._overlapped_read.hEvent)  
  AttributeError: 'NoneType' object has no attribute 'hEvent'  
  </code></pre>
  
  <p>My application seems to work fine despite this exception being thrown.<br>
  However, I would like some clarity on the source of this issue.   </p>
  
  <p>Here is my serial read function. </p>
  
  <pre><code>def mcuRead(self, *args, **kwargs):
  
      global mcuPort
      global readVal
      global serialWriting
      global testRunning
  
      print("READING MCU")
      sys.stdout.flush()
      inBuffer = ""
  
      while testRunning:
          try:
              byteIn = ""
              if not mcuPort.is_open:
                  mcuPort.open()
  
              #Read incoming byte 
              if not serialWriting:
                  byteIn = mcuPort.read()
                  inBuffer += byteIn
                  #Skip newlines to parse incoming commands
                  if(byteIn == "\n"):                     
                      inBuffer = ""
  
                  #Check if buffer contains a valid command
                  for rxCmd in mcuRxCmds:
  
                      if inBuffer == rxCmd['Command']:
  
                          #store incoming command globally
                          readVal = rxCmd['Command']
                          #Clear buffer
                          inBuffer = ""
                          print("MCU IN "+str(readVal))
  
          except(OSError, serial.SerialException):
              print(OSError)
  
          sys.stdout.flush()
  </code></pre>
  
  <p>Serial port is created globally as follows.  Read function is run concurrently on a separate thread. </p>
  
  <pre><code>mcuPort = serial.Serial(port, 115200, timeout=0)
  </code></pre>