from os import mkfifo, remove, chmod from os.path import exists class Pipe: def __init__(self, path): self.path = path def recreate(self, permissions): self.remove() mkfifo(self.path) chmod(self.path, permissions) def remove(self): if exists(self.path): remove(self.path)