thread and processes with python/GTK

Thomas Guettler guettli.usenet at thomas-guettler.de
Tue Jan 30 10:44:30 EST 2007


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.leermann at thomas-guettler.de




More information about the Python-list mailing list