473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to bring subprocess to the foreground?

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
Sep 6 '08 #1
4 7813
du**********@gmail.com schrieb:
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
Sep 6 '08 #2
On Sat, Sep 6, 2008 at 3:13 PM, Diez B. Roggisch <de***@nospam.web.dewrote:
du**********@gmail.com schrieb:
>>
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
Sep 6 '08 #3
On 6 Sep, 17:58, dudeja.ra...@gmail.com wrote:
>
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...
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.
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
Sep 6 '08 #4
On Sat, Sep 6, 2008 at 6:53 PM, Paul Boddie <pa**@boddie.org.ukwrote:
On 6 Sep, 17:58, dudeja.ra...@gmail.com wrote:
>>
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...
> 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.
> 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
Sep 6 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Kitt | last post by:
I don't know where to ask this question. If you know of a better place to ask it, please let me know. I have a main web page containing many links to detail pages. All detail links open with...
7
by: Brian Kitt | last post by:
I don't know where to ask this question. If you know of a better place to ask it, please let me know. I have a main web page containing many links to detail pages. All detail links open with...
0
by: Brian Kitt | last post by:
I don't know where to ask this question. If you know of a better place to ask it, please let me know. I have a main web page containing many links to detail pages. All detail links open with...
4
by: ghadley_00 | last post by:
Hi, Can anyone recommend a piece of VBA code I could attach to a button in a MS Form form that will close the current form and bring the switchboard to foreground. I'm trying to integrate a form...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.