i am trying to get the output of a command in my python program by using "check_output" method. but i'm getting this error:
out = check_output(command5 , shell=True)
File "/usr/lib64/python3.6/subprocess.py", line 336, in check_output **kwargs).stdout File "/usr/lib64/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command 'oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_rht-ccp --results-arf arf.xml /usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml' returned non-zero exit status 2.
this is the part of my program that is related:
command4 = "oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_rht-ccp --results-arf arf.xml /usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml"
out = check_output(command4 , shell=True)
I am sure that the command is alright because I get the results when I write:
subprocess.call(command5,shell=True)
I am using python 3.6, and work in centos 7.
any idea why the check_output
can not get the result?