from PyQt5.QtSerialPort import QSerialPort
from PyQt5.QtCore import QIODevice
ser = QSerialPort("COM4")
ser.setBaudRate(9600)
ser.setFlowControl(QSerialPort.NoFlowControl)
ser.setParity(QSerialPort.NoParity)
ser.setDataBits(QSerialPort.Data8)
ser.setStopBits(QSerialPort.OneStop)
opened = ser.Open(QIODevice.ReadOnly)
print(opened)
for i in range(2000):
print(ser.read(100))