suppress opening command window after using os.system command

B

boriq

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
 
G

Gabriel Genellina

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
 
B

boriq

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?

Thx
 
G

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?

Sure, depending on your needs, use any of the os.popen variants or any of
the os.spawn variants.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top