By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,375 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,375 IT Pros & Developers. It's quick & easy.

pygtk and long running process

P: n/a
Hi,

I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out put
and for instance update a text box.

Regards,

Rob
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Robert wrote:
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out put
and for instance update a text box.


os.popen() will probably do what you want.

e.g.:

import os

some_external_command = "ls"
prog_output = os.popen(some_external_command)
for status_line in prog_output:
print status_line

-Dan
Jul 19 '05 #2

P: n/a
Daniel Cer wrote:
Robert wrote:
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out put
and for instance update a text box.

os.popen() will probably do what you want.

e.g.:


(....)

As for the latter part of (b)....

I don't know much about pygtk, but I imagine you should be able to put
the code that monitors the external program in a thread, and then
whenever you get some new status information update the text box.

-Dan
Jul 19 '05 #3

P: n/a
On Sun, 24 Apr 2005 19:46:52 -0600, Daniel Cer wrote:
Daniel Cer wrote:
Robert wrote:
I have a command line app that can take up to 20 minutes to complete and
every minute or so updates it's status (spits it out to console). I am
writing a front end for this app in python/gtk and was wondering what
command I use to a) invoke the command and b) how to capture it's out put
and for instance update a text box.

os.popen() will probably do what you want.

e.g.:


(....)

As for the latter part of (b)....

I don't know much about pygtk, but I imagine you should be able to put
the code that monitors the external program in a thread, and then
whenever you get some new status information update the text box.

-Dan


Thanks for your help

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.