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

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.
bergelAsked:
Who is Participating?
 
RichieHindleCommented:
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
 
bergelAuthor Commented:
Excellent.  Thanks, this solved my problem.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.