I am trying to redirect some shell script output to /dev/null within subprocess.call, but it always prints on stdout.
Here is my shell script
# cat /usr/local/scripts/test_unknown.sh
#!/bin/bash
echo "Testing Unknown..."
exit 3
Executing in python
# python
Python 2.7.5 (default, Aug 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call(["/bin/sh", "/usr/local/scripts/test_unknown.sh", "2>&1 >/dev/null"])
Testing Unknown...
3
>>>
Executing the same script in command line
# /bin/sh "/usr/local/scripts/test_unknown.sh" 2>&1 >/dev/null
#
What am i missing ?