I opened a temporary file with the following code in Python:
p=subprocess.Popen(tempFileName,shell=True)
processId=p.pidcode
I want to remove that temporary file, when that file is closed. I wanted to remove the file with the PiD of opening process, but the problem is even when I close that file pid still exists.
p=subprocess.Popen(tempFileName,shell=True)
processId=p.pid
Are there any other ways to remove that temporary file?
Popen
doesn't open a temporary file. It runs an external program and provides references to its standard input/output/error. Even so, the value of thepid
attribute isn't going to change simply because the process that used to use that ID has completed.subrocess.Popen
doesn't open a file - check the docs