Hiding shell output from subprocess.check_output ()
I get information about my wireless connection using
In : subprocess.check_output('iwconfig') eth0 no wireless extensions. lo no wireless extensions. Out: 'wlan0 ...'
I get the line I want, but I would like to clear the shell of information about
(note that these lines are not on the return line
, they are printed to the shell between ipython
My final guess is that these two lines are considered a warning and not caught
. Hoping that they are output to
, I tried several options
iwconfig > /dev/null 2>&1 # empties my wanted string iwconfig 2 > /dev/null # throws an error
but without success so far.
How can I prevent
shell output ?
source to share