IOstreams/pipes, newbie question, capturing console info form another script?

Chris Liechti cliechti at gmx.net
Sat Mar 23 11:31:32 EST 2002


"G. Willoughby" <sab at NOSPAM.freeuk.com> wrote in
news:a7i9kq$ujm$1 at news7.svr.pol.co.uk: 
...
>  os.system("python mapper.py -settings mappergui.ini -scale %s -out
> latest_render.jpg -zone %s" % (self.imageSize, self.currentZone))
>  [/snip]
>  now i was wondering because this 'mapper.py' script and an 
> included 'zone.py' writes alot of info to the console using 
> 'sys.stdout.write()'
> can i intercept this using my first Tkinter prgram so i can display
> this info in another freshly created window. basically i am writing 
> a gui for a cmdline script! if so has anyone got any examples of 
> code for me to look at that would be great!

have a look at os.popen. it returns a file-like object where you can 
read the output from the programm you started.

chris

(PS: the NOSPAM will not help much, but its an inconvenience for 
people that want to anwser you. some months ago we had a discussion 
aout that on this group.)
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list