reading from pipe

Richard Lamboj richard.lamboj at bilcom.at
Mon Jan 25 11:59:13 CET 2010


Hello,

is there any solution to catch if a pipe has closed? Maybe the signal modul?

For Simulation:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

while True:
	line = sys.stdin.readline()

	sys.stdout.write(line)
	sys.stdout.flush()

time cat /tmp/proxy.test | test.py

Solution:
if line == "":
	break

Kind Regards,

Richi



More information about the Python-list mailing list