I have a hardware which has 7 USB connection from which i am continuously receiving(200KBps from each) and writing data to a text file, Using python 2.7 and PYSerial lib. I have 7 seven different threads(for each usb port) to capture and save data to different text files.Now the problem is i am missing some of my data in my saved files
$77194,....#//Serial no indicating continuity
$77195,....#
$77196,....#
$77197,....#
$77230,....#//Data missing
$77231,....#
Main Codes
for portValue in ports:
t1 = threading.Thread(target=obj_capture.run_exe, args=(portValue))//ex of portValue = '/ttyAMC0'
threads.append(t1)
t1.start()
for t in threads:
t.join()
Main Data Capturing Code
def run_exe(self,serial_port)
ser = serial.Serial(
port=serial_port,
baudrate=115200,
bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
timeout=0,#None
xonxoff=False,
rtscts=False,
dsrdtr=False,
)
workbook = open(ExFile.txt, "a+")
while True:
if ser.in_waiting:
try:
readSerialData = ser.read(ser.inWaiting())
workbook.write(readSerialData)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(e, exc_tb.tb_lineno)