Reputation: 363566
To get a unique name for a temporary file you can use NamedTemporaryFile
. But I want a fifo instead of a regular file, so something like:
name = generate_unique_name() # how?
try:
os.mkfifo(name)
# do stuff with the FIFO
finally:
os.remove(name)
Is there a stdlib way to autogenerate a temporary filename which is guaranteed to be unique in a directory?
Upvotes: 1
Views: 1605
Reputation: 129139
Python has the tempfile
module, which may have what you're looking for in it.
Upvotes: 11