def harmonization_extract_worker(args): filename = args[0] name_queue = args[1] try: tree = extract_unii.parse_xml(filename) harmonized = {} unii_list = [] intermediate = [] harmonized['unii'] = extract_unii.extract_unii(tree) harmonized['set_id'] = extract_unii.extract_set_id(tree) harmonized['name'] = extract_unii.extract_unii_name(tree) #zipping together two arrays, since they came from the same xpath locations #these are the NUI codes and their respective names #we might be able to get the names from somewhere else and avoid the zip intermediate = zip(extract_unii.extract_unii_other_code(tree), extract_unii.extract_unii_other_name(tree)) # print intermediate header = ['number', 'name'] harmonized['va'] = [dict(zip(header, s)) for s in intermediate] # unii_list[harmonized['unii_name']] = harmonized unii_list.append(harmonized) name_queue.put(unii_list) except Exception as inst: print filename + 'has a problem' print inst