import psutil, os

target = 'dmg_main.dfm'
found = False
for proc in psutil.process_iter(['pid', 'name']):
    try:
        files = proc.open_files()
        for f in files:
            if target in f.path.lower():
                print(f"Locked by: {proc.info['name']} (PID {proc.info['pid']}) -> {f.path}")
                found = True
    except Exception:
        pass
if not found:
    print("No open handles found via psutil")
