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())
       self.mainTextWindow.append(outputString)
# Check if upgradeProcess ask to continue
       if outputString.endsWith("? "):
           qApp.processEvents()
#### need to call QDialog 'confirmUpgrade' and have it set 'answer' #### # Determine action to take
           if answer == "upgradeYes":
               self.upgradeProcess.tryTerminate()
               self.doCommitUpgrade()
else:
               self.upgradeProcess.tryTerminate()
               self.mainTextWindow.append("User terminated")
ouputString = " "

Thanks
Tina
--

Project: Tinapt
http://tinapt.berlios.de/
SVN repository:
http://svn.berlios.de/wsvn/tinapt/trunk/?rev=0&sc=0

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to