Ignoring CalledProcessError
Something like this perhaps?
def shell(command): try: output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) except Exception, e: output = str(e.output) finished = output.split('\n') for line in finished: print line return