Hiding Console Output

John Savage rookswood at suburbian.com.au
Sat Aug 5 01:28:08 EDT 2006


"Kkaa" <onlyafly at gmail.com> writes:
>I'm using the os.system command in a python script on Windows to run a
>batch file like this:
>
>os.system('x.exe')

Is .exe really a batch file?

>The third-party program x.exe outputs some text to the console that I
>want to prevent from being displayed.  Is there a way to prevent the
>output of x.exe from python?

To consign stdout to nul in MSDOS you can use os.system('x.exe>nul')
so that will probably work for windows, too. This works regardless
of x.exe or x.bat so should do for whatever type of prog you are wanting
it for.
-- 
John Savage                   (my news address is not valid for email)



More information about the Python-list mailing list