Is there any way to read stdin line by line without blocking? My application
receives data over stdin (one command per line) and should react immediately.
I've tried to make such thing:
self.stdin = QtCore.QFile(self)
self.stdin.open(0, QtCore.QIODevice.ReadOnly)
self.connect(self.stdin, Qt.SIGNAL('readyRead()'), self.on_stdinReadyRead)
buy readyRead never fires.
Then I've added
self.qsn = QtCore.QSocketNotifier(0, QtCore.QSocketNotifier.Read, self)
self.connect(self.qsn, Qt.SIGNAL('activated(int)'), self.on_qsn)
and made on_qsn() call on_stdinReadyRead. It works but there's another problem:
self.stdin.canReadLine() never returns true, and readAll() blocks forever.
any hint?
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt