I wrote:

Yes, I have already thought about that and it's indeed the language that is the problem with that approach. So I was thinking that if I could catch the process waiting for input I could pick up the question (since I know what it asks for and what form it has. Like: "Do you want to continue [Y/n]?" Then let an 'OK' button or something feed the upper case letter to stdin).


Ok, so I managed to isolate the yes or no option regardless of language. But I can't seem to feed it correctly to the apt-get process. The code:

def readOutput(self):
       outputString = QString(self.upgradeProcess.readStdout())
       self.mainTextWindow.append(outputString)
# Check if upgradeProcess ask to continue
       if outputString.endsWith("? "):
           qApp.processEvents()
# Isolate the yes/ no characters needed for input.
           yesOptionString = outputString.right(6)
           yesOption = yesOptionString.left(1)
           noOptionString = outputString.right(4)
           noOption = noOptionString.left(1)
answer = yesOption # Temporary setting answer for testing. Will be replaced by user input.
           self.mainTextWindow.append(answer) # Temporary to verify answer
# Feed answer to stdin
           if answer == yesOption:
self.mainTextWindow.append("This is the yesOption!!") # Temporary just to verify that Y is isolated
               self.upgradeProcess.writeToStdin(yesOption)
               ## self.upgradeProcess.writeToStdin(chr(121)) #No difference
else: self.mainTextWindow.append("This is the noOption!!") # Temporary just to verify that Y is isolated
               self.upgradeProcess.writeToStdin(noOption)
self.upgradeProcess.closeStdin()
           ouputString = " "


I do feed 'something' that apt-get recieves because it aborts. It would not have done that unless it got a response of some sort. But even if I replace the 'yesOption' with the letter "y" it still just aborts. So I'm thinking that either I don't know how to properly write to stdin (a distinct posibility) or apt-get uses some other program/ process/ interface to handle user interaction.

I have tried looking for clues in apt's sourcecode but C++ is really not my cup of tea so I'm still stuck. And I'm running out of ideas...
So if anyone have an idea I'd really appreciate it.

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