import os
import sys
import atexit
thefifo = 'comms.fifo'
os.mkfifo(thefifo)

def cleanup():
    os.remove(thefifo)
atexit.register(cleanup)
while True:
    with open(thefifo, 'r') as fifo:
        for line in fifo:
            pass
How to feed information to a Python daemon?