For this you should use the standard redirection offered (in unix) since the 1960's and in the dos/windows world since cp/m 3 around 1983.
As a general rule:
- data-information (like results of sql query - i.e. data) goes to stdout ('>' or '1>')
- extended information (as in this case) and errors goes to stderr ('2>')
This is the intended default behavior
- which can easily be overrided by the user
# real world:
python myprogram.py 2> /dev/null
# windows world:
python myprogram.py 2> nul
With the use of '1>/dev/null 2>&1' (for windows replace '/dev/null' with 'nul')
--> both outputs will be transported to the 'land of nothing'
See my answer at:
for a sample I found (but not tested - not being a python person)
- how this is done from inside a python script
Mark