1import subprocess
2try:
3 subprocess.check_output("dir /f",shell=True,stderr=subprocess.STDOUT)
4except subprocess.CalledProcessError as e:
5 raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
6