thread and processes with python/GTK

awalter1 alain.walter at thalesgroup.com
Wed Jan 31 03:47:13 EST 2007


HI,

I launch my application by 'python script.py'
I've already add a sys.stdout.flush with no effect.

if the idle_add is an alternative to thread, where to get details
about its use (no reference in http://www.pygtk.org/docs/pygtk/
index.html, but very brief information in GTK+ documentation)
In my case how to implement the system call 'ps -def' through idle_add

Thanks

On 30 jan, 16:44, Thomas Guettler <guettli.use... at thomas-guettler.de>
wrote:
> Hi,
>
> how do you start the python app? Goes stdout
> to a terminal or a pipe?
>
> "python script.py"
> and "python script.py | cat" behave different.
>
> Maybe "sys.stdout.flush()" helps you.
>
> BTW, I switched from threads to idle_add for pygtk
> applications.
>
>
>
>
>
> awalter1 wrote:
> > Hello,
>
> > I'm developping an application with python, pyGTK and GTK+.
> > I've performed many tests by using methods as Popen, popen2,
> > os.system ... to communicate with Unix (HPUX),
> > The last attempt is this code written in a thread :
> >        fin,fout = popen2.popen2('ps -def')
> >        line = fin.readline()
> >        while 1 :
> >            if not line : break
> >            print "line=",line
> >            line = fin.readline()
> >        fin.close()
> > In that case, lines are printed only when I exit my application.
> > Usually the behavior is not as expected and I cannot understand why. I
> > am wondering that it could be a constraint from the use of GTK
> > (mainloop() existence ???).
> > Is somebody aware about conflict between GTK use and unix mechanism.
>
> > Thanks for you help
>
> --
> Thomas Güttler,http://www.thomas-guettler.de/http://www.tbz-pariv.de/
> E-Mail: guettli (*) thomas-guettler + de
> Spam Catcher: niemand.leerm... at thomas-guettler.de- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -





More information about the Python-list mailing list