Connecting Tech Pros Worldwide Forums | Help | Site Map

How to bring subprocess to the foreground?

dudeja.rajat@gmail.com
Guest
 
Posts: n/a
#1: Sep 6 '08
Hi,

I've a batch file that I open with the subprocess .Popen() . When this
batch file is run I want to bring it to the foreground.

Please suggest how can I do this?


Regards,
Rajat

Diez B. Roggisch
Guest
 
Posts: n/a
#2: Sep 6 '08

re: How to bring subprocess to the foreground?


dudeja.rajat@gmail.com schrieb:
Quote:
Hi,
>
I've a batch file that I open with the subprocess .Popen() . When this
batch file is run I want to bring it to the foreground.
>
Please suggest how can I do this?
You can't. You can capture the stdout using the pipe-arguments, and in
your main-process, read that and write it to the main process' stdout.

Diez
dudeja.rajat@gmail.com
Guest
 
Posts: n/a
#3: Sep 6 '08

re: How to bring subprocess to the foreground?


On Sat, Sep 6, 2008 at 3:13 PM, Diez B. Roggisch <deets@nospam.web.dewrote:
Quote:
dudeja.rajat@gmail.com schrieb:
Quote:
>>
>Hi,
>>
>I've a batch file that I open with the subprocess .Popen() . When this
>batch file is run I want to bring it to the foreground.
>>
>Please suggest how can I do this?
>
You can't. You can capture the stdout using the pipe-arguments, and in your
main-process, read that and write it to the main process' stdout.
>
Diez
--
http://mail.python.org/mailman/listinfo/python-list
>
Hi Diez,

Thanks for the information.
That's valuable information.

I though of displayin an information message on the screen through
tkMessageBox while the subprocess is running, I did it using:

try:
testing = subprocess.Popen([batchFilePath], \
shell = True)

retCode = testing.wait()
tkMessageBox._show("Test Harness execution", \
icon = 'info', \
message="Testing %s in progress..." % libName)
except:
tkMessageBox._show("Error", \
type='ok', icon='error', \
message="Error executing %s Test
Harness" % libName)
return None
else:
print retCode


But the message is never displayed. Please suggest if there is
something wrong with this code

--
Regards,
Rajat
Paul Boddie
Guest
 
Posts: n/a
#4: Sep 6 '08

re: How to bring subprocess to the foreground?


On 6 Sep, 17:58, dudeja.ra...@gmail.com wrote:
Quote:
>
I though of displayin an information message on the screen through
tkMessageBox while the subprocess is running, I did it using:
>
try:
testing = subprocess.Popen([batchFilePath], \
shell = True)
>
retCode = testing.wait()
Note that you wait for the process to finish here...
Quote:
tkMessageBox._show("Test Harness execution", \
icon = 'info', \
message="Testing %s in progress..." % libName)
....and that you show a message about the process running *after*
waiting until it isn't running any more.
Quote:
except:
tkMessageBox._show("Error", \
type='ok', icon='error', \
message="Error executing %s Test
Harness" % libName)
return None
else:
print retCode
>
But the message is never displayed. Please suggest if there is
something wrong with this code
I think you should first show your message, *then* wait for the
process to finish.

Paul
dudeja.rajat@gmail.com
Guest
 
Posts: n/a
#5: Sep 6 '08

re: How to bring subprocess to the foreground?


On Sat, Sep 6, 2008 at 6:53 PM, Paul Boddie <paul@boddie.org.ukwrote:
Quote:
On 6 Sep, 17:58, dudeja.ra...@gmail.com wrote:
Quote:
>>
>I though of displayin an information message on the screen through
>tkMessageBox while the subprocess is running, I did it using:
>>
>try:
> testing = subprocess.Popen([batchFilePath], \
> shell = True)
>>
> retCode = testing.wait()
>
Note that you wait for the process to finish here...
>
Quote:
> tkMessageBox._show("Test Harness execution", \
> icon = 'info', \
> message="Testing %s in progress..." % libName)
>
...and that you show a message about the process running *after*
waiting until it isn't running any more.
>
Quote:
> except:
> tkMessageBox._show("Error", \
> type='ok', icon='error', \
> message="Error executing %s Test
>Harness" % libName)
> return None
> else:
> print retCode
>>
>But the message is never displayed. Please suggest if there is
>something wrong with this code
>
I think you should first show your message, *then* wait for the
process to finish.
>
Paul
--
http://mail.python.org/mailman/listinfo/python-list
>
Such a silly mistake I'm committing.
Thanks a ton.

--
Regrads,
Rajat
Closed Thread