I need to create a folder that I use only once, but I need it to exist until the next start. It looks like I should use the tmp_file module in the standard library, but I'm not sure how to get the behavior that I want.
Currently, to create a directory, I am doing the following:
randName = "temp" + str(random.randint(1000, 9999))
os.makedirs(randName)
And when I want to delete a directory, I am just looking for a directory with "temp" in it.
This seems like a dirty hack, but so far I'm not sure about the best way.
By the way, the reason I need a folder is because I am running a process that uses a folder with the following:
subprocess.Popen([command], shell=True).pid
and then close my script so that another process exits.