How to bring subprocess to the foreground?

dudeja.rajat at gmail.com dudeja.rajat at gmail.com
Sat Sep 6 11:58:47 EDT 2008


On Sat, Sep 6, 2008 at 3:13 PM, Diez B. Roggisch <deets at nospam.web.de> wrote:
> dudeja.rajat at 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



More information about the Python-list mailing list