[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to hide the MS-dos window of an outside dos program in python

Posted on 2005-05-04
2
Medium Priority
?
2,228 Views
Last Modified: 2008-01-09
In my python program, I use spawnl and os.system to call an outside dos .exe program. When that dos program is called and running, a MS-Dos window appears briefly and then disappears as the dos program ends. My question is: is there any way to suppress the appearance of that Dos Window? I am using py2exe to distribuite the program.
0
Comment
Question by:bergel
2 Comments
 
LVL 14

Accepted Solution

by:
RichieHindle earned 2000 total points
ID: 13933624
Instead of this, for example:

    os.system("dir")

you can do this:

    os.popen("dir").read()

which will run the command invisibly, reading and discarding its output.
0
 

Author Comment

by:bergel
ID: 13934622
Excellent.  Thanks, this solved my problem.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Less strange, but still introduction This introduction was added (1st August, 2011) to reflect some reactions.  Firstly, the term basics in the title of the article...  As any other word, it is a symbol with meaning attached to the word by some a…
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question