def run_path(path, args): "Replacement for runpy.run_path when it doesn't exist" if has_run_path: sys.argv = ["foo"] + [str(arg) for arg in args] runpy_run_path(path) else: status = os.system("python " + path + " " + \ " ".join(str(arg) for arg in args)) if not status == 0: raise RuntimeError, "Python script failed"
def run_path(path, args): "Replacement for runpy.run_path when it doesn't exist" sys.argv = ["foo"] + [str(arg) for arg in args] try: runpy_run_path(path) except SystemExit as e: if e.args[0] == 0: pass else: raise e