mardi 5 mai 2020

IF condition does not executes in Python multithreading

From the Main function, I make the following Thread calls

with CF.ThreadPoolExecutor(max_workers=None) as executor:
    for b in bs:
        runnings.append(executor.submit(QC.FetchAndSaveInfo, b))

QC is a class that has a function: FetchAndSaveInfo taking an object as an argument. I do some processing of the object b's data and get a large text data in a variable output. and execute the following snippet.

def FetchAndSaveInfo(self, b):
    # Some processing of b here

    for pattern, gid in zip(self.patterns, self.groupids):
        m = re.search(pattern,output)
        if m is not None:
            found = True
            cpattern = cpattern +', '+m.group(gid)

Problem: If Never executes even though variable m is not None.

Aucun commentaire:

Enregistrer un commentaire