Source: C:\KKT\soft\Scrypts\Sbor dannih s kass artix\VikiPrint\Sbor_viki_1.1.py, lines 266-296 def main(): rows = [] if not os.path.isdir(ROOT_DIR): print(f"ERROR: directory not found: {ROOT_DIR}", file=sys.stderr) sys.exit(2) for root, dirs, files in os.walk(ROOT_DIR): base = os.path.basename(root) if not base.lower().startswith("cash-"): continue store, pc = parse_store_pc(base) if store is None or pc is None: continue for fname, tag in FR_FILES: full_path = os.path.join(root, fname) if not os.path.isfile(full_path): continue try: rows.append(process_json(full_path, tag, store, pc)) except Exception: print(f"[WARN] processing error: {full_path}", file=sys.stderr) os.makedirs(os.path.dirname(OUT_CSV), exist_ok=True) with open(OUT_CSV, "w", newline="", encoding="utf-8-sig") as file: writer = csv.DictWriter(file, fieldnames=CSV_HEADERS, extrasaction="ignore") writer.writeheader() for row in rows: writer.writerow(row) print(f"[OK] wrote {len(rows)} rows")