[PyKDE] QProcess: more guidance needed

Tina Isaksen tina at bestemselv.com
Thu Mar 9 06:40:02 GMT 2006

I wrote:

> David Boddie wrote:
>> Have you tried sending "y\n" to the process's stdin, just as you would
>> type it in a console?
>> David
> Not sure I understand what you mean. In a console one types "y[enter]" 
> or "n[enter]"
> Actually only 'y' or 'Y' matters. Every other response causes apt-get 
> to abort.
> And that's the weird part because even if I send a y or an Y, it will 
> abort. I also tried to convert it to ascii numbers with no success. 
> But the simple fact that it aborts must mean that it in fact reads 
> that I send 'something' to stdin, right?

I gave up. I just could not get a QProcess write to a process stdin. So 
I made a 'dirty' workaround: I terminated apt-get after it ask it's 
question, then start a new apt-get process with the 'assume yes' option 
if the users answer is 'Yes'. Which brings me to my next question:

How can I call a Qdialog I have made in Qt3 designer and have it set a 
variable ('answer') in my main program? The Qdialog only has two buttons 
called pbUpgradeYes and pbUpgradeNo.

def readOutput(self):
        outputString = QString(self.upgradeProcess.readStdout())
        # Check if upgradeProcess ask to continue
        if outputString.endsWith("? "):
            #### need to call QDialog 'confirmUpgrade' and have it set 
'answer' ####
            # Determine action to take
            if answer == "upgradeYes":
                self.mainTextWindow.append("User terminated")
            ouputString = " "


Project: Tinapt
SVN repository:

More information about the PyQt mailing list