os open self _path os O_RDONLY os O_NONBLOCK while True try output os

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
os.open(self._path, os.O_RDONLY | os.O_NONBLOCK)
while True:
try:
output = os.read(self.fileno(), self.chunk_size)
except (OSError, IOError), err:
if err.args[0] in (errno.EAGAIN, errno.EINTR):
return
else:
return main.CONNECTION_LOST
if not output:
return main.CONNECTION_DONE
self.protocol.dataReceived(output)