![]() ![]() Print >sys.stderr, "Execution failed:", e ![]() Print >sys.stderr, "Child returned", retcode If retcode >sys.stderr, "Child was terminated by signal", -retcode Retcode = subprocess.call("open " filename, shell=True) If you need to be compatible all the way back to Python 2.4, you can use subprocess.call() and implement your own error checking: try: In Python 3.5 you can equivalently use the slightly more complex but also somewhat more versatile n(, check=True) You can also call them via subprocess module, but.įor Python 2.7 and newer, simply use subprocess.check_call() ![]()
0 Comments
Leave a Reply. |