469,898 Members | 1,574 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

suppress opening command window after using os.system command

Hi,

I'm using in my script command os.system('command') on Windows XP.
Each time the os.system command is used, python opens an empty ms-dos
command window (the black one) and then closes it. So when in one
script the os.system command 50 times is used, I see 50 black windows.

Is there a way of how to suppress this unnecessary command windows to
be opened?

thx.
Boris
Jun 27 '08 #1
4 2478
En Thu, 12 Jun 2008 05:28:13 -0300, boriq <bo***********@gmail.com>
escribió:
I'm using in my script command os.system('command') on Windows XP.
Each time the os.system command is used, python opens an empty ms-dos
command window (the black one) and then closes it. So when in one
script the os.system command 50 times is used, I see 50 black windows.

Is there a way of how to suppress this unnecessary command windows to
be opened?
Use the subprocess module instead of os.system

--
Gabriel Genellina

Jun 27 '08 #2
On 12 Jun., 11:51, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
En Thu, 12 Jun 2008 05:28:13 -0300, boriq <boris.smir...@gmail.com*
escribió:
I'm using in my script command os.system('command') on Windows XP.
Each time the os.system command is used, python opens an empty ms-dos
command window (the black one) and then closes it. So when in one
script the os.system command 50 times is used, I see 50 black windows.
Is there a way of how to suppress this unnecessary command windows to
be opened?

Use the subprocess module instead of os.system

--
Gabriel Genellina
I'm on version 2.2.1 because of a program we use and it uses this
version.

and the subprocess module was implemented in version 2.4

Any possibility to do it with the old stuff in ver 2.2.1?

Thx
Jun 27 '08 #3
En Thu, 12 Jun 2008 07:08:00 -0300, boriq <bo***********@gmail.com>
escribió:
On 12 Jun., 11:51, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
>En Thu, 12 Jun 2008 05:28:13 -0300, boriq <boris.smir...@gmail.com*
escribió:
I'm using in my script command os.system('command') on Windows XP.
Each time the os.system command is used, python opens an empty ms-dos
command window (the black one) and then closes it. So when in one
script the os.system command 50 times is used, I see 50 black windows.
Is there a way of how to suppress this unnecessary command windows to
be opened?

Use the subprocess module instead of os.system

I'm on version 2.2.1 because of a program we use and it uses this
version.

and the subprocess module was implemented in version 2.4

Any possibility to do it with the old stuff in ver 2.2.1?
Sure, depending on your needs, use any of the os.popen variants or any of
the os.spawn variants.

--
Gabriel Genellina

Jun 27 '08 #4
Gabriel Genellina wrote:
En Thu, 12 Jun 2008 07:08:00 -0300, boriq <bo***********@gmail.com>
escribió:
>On 12 Jun., 11:51, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
>>En Thu, 12 Jun 2008 05:28:13 -0300, boriq <boris.smir...@gmail.com>
escribió:

I'm using in my script command os.system('command') on Windows XP.
Each time the os.system command is used, python opens an empty ms-dos
command window (the black one) and then closes it. So when in one
script the os.system command 50 times is used, I see 50 black windows.

Is there a way of how to suppress this unnecessary command windows to
be opened?

Use the subprocess module instead of os.system

I'm on version 2.2.1 because of a program we use and it uses this
version.

and the subprocess module was implemented in version 2.4

Any possibility to do it with the old stuff in ver 2.2.1?

Sure, depending on your needs, use any of the os.popen variants or any
of the os.spawn variants.
Or you can download the external module which became the subprocess
module in the stdlib:

http://www.lysator.liu.se/~astrand/popen5/

TJG
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Evan Kontos | last post: by
reply views Thread by Laura Zeafla via .NET 247 | last post: by
14 posts views Thread by D. Alvarado | last post: by
2 posts views Thread by sjp | last post: by
reply views Thread by January Smith | last post: by
reply views Thread by bbrewder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.