Created
December 6, 2016 20:45
-
-
Save nicoddemus/21417f07b42629a474c9b90d996fdaab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
os.remove(filename) | |
except PermissionError as e: | |
print('THIS PID', os.getpid()) | |
import psutil | |
for proc in psutil.process_iter(): | |
try: | |
files = proc.open_files() | |
except psutil.AccessDenied: | |
continue | |
if files: | |
print(proc.pid, proc.name) | |
for filename in files: | |
print(" -", filename.path) | |
assert 0, str(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment