title: PyQt5 QtSerialPort Error QSocketNotifier: Invalid socket specified
body: <p>I'm trying to use QtSerialPort for a PyQt5 project but haven't found the magic.  Right now the code seems to be opening the port but I'm getting "QSocketNotifier: Invalid socket specified" error whenever I try to write to the port.  Here's the latest code:</p>
  
  <pre><code>#!/usr/bin/env python3
  
  from PyQt5 import QtGui, QtCore, QtWidgets
  from PyQt5.QtSerialPort import QSerialPort, QSerialPortInfo
  
  class QtSerialTest():
  
      def __init__(self):
          super(QtSerialTest, self).__init__()
  
          self.serinfo = QSerialPortInfo()
          p = self.serinfo.availablePorts()
          for pport in p:
              print(pport.portName())
  
          portname = p[0].portName()
          self.ser = QSerialPort(portname)
          self.ser.setBaudRate(9600)
          print(self.ser.isOpen())
          self.ser.setOpenMode(QSerialPort.ReadWrite)
          print(self.ser.isOpen()) 
  
          self.ser.writeData(b'Test')
  
  if __name__=='__main__':
      ser = QtSerialTest()
  </code></pre>
  
  <p>The output from this code on my machine is:</p>
  
  <pre><code>ttyUSB0
  ttyUSB1
  ttyUSB2
  ttyUSB3
  ttyUSB4
  ttyUSB5
  ttyUSB6
  ttyUSB7
  False
  True
  QSocketNotifier: Invalid socket specified
  </code></pre>
  
  <p>Any idea what is causing the QSocketNotifier error, or how to troubleshoot it?  If you run this code do you get the same error?</p>