472,354 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 2581
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Evan Kontos | last post by:
I am using the window.open function to open a small window and I am using GET to get values back from that window. I want to be able to open another from the second window but I get an error...
0
by: Laura Zeafla via .NET 247 | last post by:
I have an application I wrote using the Windows Form Application(.NET) wizard. Pressing a button calls a function in a dllwritten in Visual C++. This function is supposed to cause acommand prompt...
4
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
by: sjp | last post by:
I need to open new windows only for the purpose of viewing linked images, maybe a dozen or so throughout the site. Using the Target="blank" command is quick, easy and seems like the best way to...
1
by: DFS | last post by:
I'm using a query as the SourceObject for a subform. When I change any of the column widths and try to close the form I'm prompted to save changes to the layout. Anyone know how to suppress...
0
by: January Smith | last post by:
When I run the code below after creating an Empty .Net type project and adding an Empty C++ file it always opens a command window before displaying the form. If I write a similar VB application by...
2
by: brianflannery | last post by:
Greetings! My situation is this. I currently have a database of which in a form displays jpeg pictures (one at a time) which are linked to the db and stored in a separate folder. I have set up a...
0
by: bbrewder | last post by:
I am struggling with some MSAccess automation issues. Basically, we have a .Net application that uses MSAccess for reporting (legacy code). We are able to launch MSAccess fine and even work with...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.