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?
Python has the
tempfilemodule, which may have what you’re looking for in it.