Serial data getting lost using PYSerial python library

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
$77230,....#//Data missing

Main Codes

for portValue in ports:
     t1 = threading.Thread(target=obj_capture.run_exe, args=(portValue))//ex of portValue = '/ttyAMC0'
for t in threads:

Main Data Capturing Code

def run_exe(self,serial_port)
  ser = serial.Serial(
workbook = open(ExFile.txt, "a+")
 while True:  
      if ser.in_waiting:
           readSerialData =
         except Exception as e:
           exc_type, exc_obj, exc_tb = sys.exc_info()
           print(e, exc_tb.tb_lineno)

Hi @rajat7693

Welcome to Toradex community.

Please provide us the Hardware and software version of your setup and What do you mean by missing data?? did you tried the same procedure with c program ??

Hi @ashok.tx

Hardware and Software version :
Carrier Board : My Apalis Evaluation Board,
SOM board : Apalis iMX6,
Operating System: The Ångström Distribution v2017.12, Architecture: arm

By missing data i meant that it looks like my buffers are overflowing and my data is getting lost and not being logged in my files(as you can see above in serial numbers).
No i did not tried with c program what difference will it make?

My each usb is connected through a hub.2 usb mapped to one hub.

Hi @rajat7693

Are you attaching USB to UART devices to get the serial data?? what is the exact hardware setup and if possible can you send us the sample code??

My custom made carrier board has 3 usb Hub ,each hub has two usb connected.
Work of Aplis iMX6 is to collect data coming through usb from six micro controllers(STM32).Each micro controller is sending data at speed of 200KBps.There is no usb to UART bridge.