system cannot find the specified file python subprocess -
i trying run simple command in python:
from subprocess import * check_output("ls")
when run raises
error: windowserror: [error 2] system cannot find file specified
ls
doesn’t exist on windows; dir
does. furthermore, may need pass shell=true
, since it’s built in cmd.exe
.
if it’s not test , want contents of directory, use os.listdir
instead.
Comments
Post a Comment