I've read numerous questions about this subject, and even 2 which have accepted answers, which then have in the comment the same issue as i'm experiencing.
So what I want to do is catch the output of this command (which works in the command line)
sudo /usr/bin/atq
in my Python program.
This is my code (which is an accepted answer in another question)
from subprocess import Popen, PIPE
output = Popen(['sudo /usr/bin/atq', ''], stdout=PIPE)
print output.stdout.read()
and this is the result:
File "try2.py", line 3, in <module>
output = Popen(['sudo /usr/bin/atq', ''], stdout=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Why oh why is this the result (in Python 2.7, on a debian Raspbarry Wheezy install)?
subprocess.check_output().