Before open this question, I was looking at similar question, but its answer does not work in this case. After I start the process, I want to delete script folder, but I cannot. My code:
from subprocess import Popen
DETACHED_PROCESS = 0x00000008
CREATE_NEW_PROCESS_GROUP = 0x00000200
app = r"C:\Windows\notepad.exe"
Popen(app, creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, close_fds=True)
After running the script, I want to delete script folder, and I get:
I can delete the folder only if I close the process. Do you have any suggestion about how can I start the process without locking script folder?