def attach(self, pid): if not process.exists(pid): raise EnvironmentError("Process %d not exists" % pid) fileops.write(self.paths['tasks'], str(pid))