Home subprocess checkouput OSError: [Errno 2] No such file or directory
Reply: 0

subprocess checkouput OSError: [Errno 2] No such file or directory

user675
1#
user675 Published in June 19, 2018, 11:57 pm

Below is example code:

from subprocess import check_output
list1 = ['df', 'df -h']
for x in list1:
    output = check_output([x])

Getting below error for list1 of dh -h value.

File "/usr/lib64/python2.7/subprocess.py", line 568, in check_output
  process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
  errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
  raise child_exception
OSError: [Errno 2] No such file or directory

what is best method to read linux command output's in python2.7

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323594 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO