From 5c08bd0601b766f223bce367d18bd48aad53c041 Mon Sep 17 00:00:00 2001 From: euri10 Date: Thu, 9 Nov 2023 11:41:13 +0100 Subject: [PATCH] who holds the file ??? --- johnnycanencrypt/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/johnnycanencrypt/__init__.py b/johnnycanencrypt/__init__.py index d6bf4a5..894799c 100644 --- a/johnnycanencrypt/__init__.py +++ b/johnnycanencrypt/__init__.py @@ -252,15 +252,17 @@ def get_pid_using_file(file_path): try: if proc.info['open_files'] is not None: if file_path in [file.path for file in proc.info['open_files']]: - return proc.info['pid'] + print(proc.info) + return proc.info['pid'], proc.info['name'] except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): pass except Exception as e: print(f"Error: {e}") return None - pid_using_file = get_pid_using_file(self.dbpath) + pid_using_file, name = get_pid_using_file(self.dbpath) print(pid_using_file) + print(name) os.rename(self.dbpath, oldpath) self.dbpath = oldpath