I am gettin a error while running the below code.
#!/usr/bin/python
import subprocess
import os
def check_output(*popenargs, **kwargs):
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
error = subprocess.CalledProcessError(retcode, cmd)
error.output = output
raise error
return output
location = "%s/folder"%(os.environ["Home"])
subprocess.check_output(['./MyFile'])
Error
subprocess.check_output(['./MyFile'])
AttributeError: 'module' object has no attribute 'check_output'
I am working on Python 2.6.4
.