check_output error in python
You probably just want to use check_output
, but, just so you know, there is a method subprocess.check_output
, but it's not defined until Python 2.7 (http://docs.python.org/3/library/subprocess.html#subprocess.check_output)
You might even want this, which defines the function in the module if it's not there (i.e. running before v2.7).
try: subprocess.check_output
except: subprocess.check_output = check_output
subprocess.check_output()
Just use :
check_output(['./MyFile'])
You've defined your own function, it's not an attribute of subprocess
module(for Python 2.6 and earlier).
You can also assign the function to the imported module object(but that's not necessary):
subprocess.check_output = check_output
location = "%s/folder" % (os.environ["Home"])
subprocess.check_output(['./MyFile'])