Monitoring UNIX File Descriptor for pty.fork() in PyQt4

  • Hello everyone, I'm trying to create a terminal for my application, in Python and PyQt. For this, I'm using psuedo terminal module in Python. pty.fork() returns a file descriptor to the child for reading and writing. So, is there any way I could monitor, the file descriptor for reading in PyQt. I've tried with QSocketNotifier, but nothing happened, i.e. the activated signal is not emmitted even though there is data available for reading.

    @class shell(QtGui.QMainWindow):

    def __init__(self,parent=None):
        return_val = pty.fork()
        if return_val[0] == 0:
            if return_val[0] >0:
                self.term_fd = QtCore.QSocketNotifier(return_val[1],QtCore.QSocketNotifier.Read)
                #print self.term_fd.readAll()
                print "ERROR"
     ##   ............... other stuff here
    def processread(self):
        print 'reading'

    ##other stuff here

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.