Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Win XP: How to hide command window for sub processes?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
klausfpga  
View profile  
 More options Oct 29, 7:41 pm
Newsgroups: comp.lang.python
From: klausfpga <klausf...@gmail.com>
Date: Thu, 29 Oct 2009 01:41:56 -0700 (PDT)
Local: Thurs, Oct 29 2009 7:41 pm
Subject: Win XP: How to hide command window for sub processes?
Hi,

I have a Python script which wants to start a subprocess and wait for
it to finish.

However I would like to have NO command window popping up during
execution.

My main Python script is started with the .pyw suffix, thus I got rid
of the main console and I just see my GUI.

So far I tried
os.system()

and subprocess.call()

with os.system() the command window pops up and I see my commands
output.

with the subprocess.call() and stdin ./ stdout / stderr redirection I
manage  to get rid of stdout/stderr
( redirecting to the file 'NUL:' )

but the window stays.

the subprocess is a call to a .exe file with multiple parameters.

I would appreciate any hints

bye

Klaus


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Ranft  
View profile  
 More options Oct 29, 9:25 pm
Newsgroups: comp.lang.python
From: Rüdiger Ranft <_r...@web.de>
Date: Thu, 29 Oct 2009 11:25:19 +0100
Local: Thurs, Oct 29 2009 9:25 pm
Subject: Re: Win XP: How to hide command window for sub processes?
klausfpga schrieb:

> Hi,

> I have a Python script which wants to start a subprocess and wait for
> it to finish.

> However I would like to have NO command window popping up during
> execution.

You need to specify the hide parameter for windows.

import subprocess
kwargs = {}
if subprocess.mswindows:
    su = subprocess.STARTUPINFO()
    su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    su.wShowWindow = subprocess.SW_HIDE
    kwargs['startupinfo'] = su
process = subprocess.Popen( (r'c:\python25\python.exe',
    r'd:\projekte\bar.py'), **kwargs )


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Rebert  
View profile  
 More options Oct 29, 9:44 pm
Newsgroups: comp.lang.python
From: Chris Rebert <c...@rebertia.com>
Date: Thu, 29 Oct 2009 03:44:37 -0700
Local: Thurs, Oct 29 2009 9:44 pm
Subject: Re: Win XP: How to hide command window for sub processes?

Interestingly, none of that appears to be documented. I smell a docs
bug waiting to be reported.

Cheers,
Chris
--
http://blog.rebertia.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin P. Hellwig  
View profile  
 More options Oct 29, 10:37 pm
Newsgroups: comp.lang.python
From: "Martin P. Hellwig" <martin.hell...@dcuktec.org>
Date: Thu, 29 Oct 2009 11:37:32 +0000
Local: Thurs, Oct 29 2009 10:37 pm
Subject: Re: Win XP: How to hide command window for sub processes?

Except for here:
http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx

> I smell a docs bug waiting to be reported.

> Cheers,
> Chris
> --
> http://blog.rebertia.com

--
MPH
http://blog.dcuktec.com
'If consumed, best digested with added seasoning to own preference.'

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Rebert  
View profile  
 More options Oct 29, 10:46 pm
Newsgroups: comp.lang.python
From: Chris Rebert <c...@rebertia.com>
Date: Thu, 29 Oct 2009 04:46:24 -0700
Local: Thurs, Oct 29 2009 10:46 pm
Subject: Re: Win XP: How to hide command window for sub processes?
On Thu, Oct 29, 2009 at 4:37 AM, Martin P. Hellwig

I was referring to the following bits of the subprocess module used in
the above code:
subprocess.mswindows
subprocess.STARTUPINFO()
subprocess.STARTF_USESHOWWINDOW
subprocess.SW_HIDE

none of which are mentioned in the module's docs:
http://docs.python.org/dev/py3k/library/subprocess.html

Cheers,
Chris
--
http://blog.rebertia.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin P. Hellwig  
View profile  
 More options Oct 29, 10:57 pm
Newsgroups: comp.lang.python
From: "Martin P. Hellwig" <martin.hell...@dcuktec.org>
Date: Thu, 29 Oct 2009 11:57:00 +0000
Subject: Re: Win XP: How to hide command window for sub processes?
Chris Rebert wrote:

<cut>

>> Except for here:
>> http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx

> I was referring to the following bits of the subprocess module used in
> the above code:

Me too actually :-)

> subprocess.mswindows
> subprocess.STARTUPINFO()
> subprocess.STARTF_USESHOWWINDOW
> subprocess.SW_HIDE

> none of which are mentioned in the module's docs:
> http://docs.python.org/dev/py3k/library/subprocess.html

Since this is platform specific stuff I would argue that it has no
business being repeated, although a link to where it is documented
elsewhere would have been nice.

--
MPH
http://blog.dcuktec.com
'If consumed, best digested with added seasoning to own preference.'


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Rebert  
View profile  
 More options Oct 29, 11:37 pm
Newsgroups: comp.lang.python
From: Chris Rebert <c...@rebertia.com>
Date: Thu, 29 Oct 2009 05:37:12 -0700
Local: Thurs, Oct 29 2009 11:37 pm
Subject: Re: Win XP: How to hide command window for sub processes?
On Thu, Oct 29, 2009 at 4:57 AM, Martin P. Hellwig

True, the Windows APIs are documented but it's not mentioned at all
that they're accessible in a certain form from subprocess.
Many other stdlib modules (e.g. `os` -
http://docs.python.org/library/os.html) include and list
platform-specific functions, I don't see why subprocess should be
different.

Cheers,
Chris
--
http://blog.rebertia.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
klausfpga  
View profile  
 More options Oct 30, 10:54 am
Newsgroups: comp.lang.python
From: klausfpga <klausf...@gmail.com>
Date: Thu, 29 Oct 2009 16:54:10 -0700 (PDT)
Local: Fri, Oct 30 2009 10:54 am
Subject: Re: Win XP: How to hide command window for sub processes?
On Oct 29, 11:25 am, Rüdiger Ranft <_r...@web.de> wrote:

Thanks Ruediger,

I'll try that immediately tomorrow, when working again on a windows
host.

Good to know, that the Python API supports this.
though this feature was not that easy to be found in the doc.

This will make my application much nicer.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Ranft  
View profile  
 More options Nov 4, 7:30 pm
Newsgroups: comp.lang.python
From: Rüdiger Ranft <_r...@web.de>
Date: Wed, 04 Nov 2009 09:30:40 +0100
Local: Wed, Nov 4 2009 7:30 pm
Subject: Re: Win XP: How to hide command window for sub processes?
klausfpga schrieb:

> On Oct 29, 11:25 am, Rüdiger Ranft <_r...@web.de> wrote:
> Thanks Ruediger,

> I'll try that immediately tomorrow, when working again on a windows
> host.

> Good to know, that the Python API supports this.
> though this feature was not that easy to be found in the doc.

Well, getting the point from subproces.py was easy. Finding the
documentation about STARTUPINFO in the MSDN was not. I better stop here
before this post turns into a rant about Mircosofts use of javascript.

bye
Rudi


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google