FIFOs are pipes that can be accessed like regular files. FIFOs exist until they are deleted (for example with os.unlink()). Generally, FIFOs are used as rendezvous between “client” and “server” type processes: the server opens the FIFO for reading, and the client opens it for writing. Note that mkfifo() doesn’t open the FIFO — it just creates the rendezvous point. To create a FIFO(named pipe) and use it in Python, you can use the os.mkfifo(). But mkfifo fails with File exists exception if file already exists. In order to avoid that, you can put it in a try-except block.
For example
import os, sys # Path to be created path = "/tmp/hourly" try: os.mkfifo(path) except OSError, e: print "Failed to create FIFO: %s" % e else: fifo = open(path, 'w') print "Path is created"
When you run this program, you can expect the pipe to be created.