[PyKDE] My thinking still wrong?

Phil Thompson phil at riverbankcomputing.co.uk
Tue Feb 28 09:25:02 GMT 2006


On Tuesday 28 February 2006 9:12 am, Tina Isaksen wrote:
> So I have been playing with Qprocess and have again run into a problem.
> I have:
>
>     from qt import *
>
>     ## snipped away most of the code ##
>
>     upgradeProcess = QProcess("apt-get")
>     upgradeProcess = addArgument("upgrade")
>     upgradeProcess.start()
>     while upgradeProcess.canReadLineStdout():
>         self.mainTextWindow.append(upgradeProcess.readLineSrdout())
>         qApp.processEvents()
>
> But I get this error: "The debugged program raised the exception
> unhandled NameError
> "global name 'addArgument' is not defined"
>
> I get the same with 'setArguments()'

    upgradeProcess = addArgument("upgrade")

...has the effect of rebinding the name "upgradeProcess" to the object 
returned by the (non-existant) function addArgument(). The object previously 
bound to "upgradeProcess" is garbage collected (assuming it has no other 
names bound to it). I think you mean...

    upgradeProcess.addArgument("upgrade")

Phil




More information about the PyQt mailing list