new to python, i found that subprocess's check_output runs nicely on Windows but it seems to only run cmds that are in windows PATH env variable.
i can execute the following fine:
import sys
from subprocess import check_output
cmd = check_output("ipconfig", shell=True)
print(cmd.decode(sys.stdout.encoding))
and ipconfig output is displayed fine.
if i try run a specific command not in the path and try absolute path i get errors.
import sys
from subprocess import check_output
cmd = check_output("c:\\test\\test.exe", shell=True)
print(cmd.decode(sys.stdout.encoding))
Is there no way to use an absolute path reference for check_output? i was not finding any..
i even tried changing to that directory..
import sys
from subprocess import check_output
import os
os.chdir("c:\\test\\")
cmd = check_output("test.exe", shell=True)
print(cmd.decode(sys.stdout.encoding))
but i get the following error
File "C:\Python35\lib\subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'naviseccli.exe' returned non-zero exit status 1
Process finished with exit code 1