Fehler-Handling weiter angepasst. Weiterreichung von getpositions bis ans Ende und Excel Ausgabe

This commit is contained in:
2025-06-04 11:16:00 +02:00
parent 0c9ad629c2
commit cbeb8345af
4 changed files with 51 additions and 3 deletions
+18
View File
@@ -268,6 +268,22 @@ def check_file_in_work(work_dir, filename):
mypath = filename
return (mypath, fexists)
def check_existance(res_mappings, res_dist, res_pos):
ret = dict()
ret["missing_distributors"] = list()
ret["missing_sensors"] = list()
for dname in res_mappings.keys():
if dname not in res_dist:
ret["missing_distributors"].append(dname)
for sname,lofsensors in res_mappings.items():
for s in lofsensors:
if s not in res_pos:
ret['missing_sensors'].append(s)
return ret
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='fetches the x/y positions from a dxf file', prog='getpositions')
parser.add_argument('-f', '--filename', action='store', required=True, default="ST_6300_Steuerungstestlayout1_neueBloecke.dwg", help='which file should be fetched', metavar='myfile.dxf')
@@ -336,6 +352,8 @@ if __name__ == '__main__':
print(to_json(res_rac))
if args.write:
basename = os.path.splitext(args.write)[0]
res_not_found = check_existance(res_mappings, res_dist, res_pos)
output_results["not_found"] = res_not_found
write_results(to_json(output_results), work_dir, f"{basename}.json")
else: