From 107844d519b156402514ac94fe83eea0f5badf26 Mon Sep 17 00:00:00 2001 From: Niles Rogoff Date: Fri, 10 Feb 2017 18:45:17 -0500 Subject: [PATCH] Handle errors --- upscale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/upscale.py b/upscale.py index 7da6a82..145178d 100755 --- a/upscale.py +++ b/upscale.py @@ -19,6 +19,11 @@ else: noise_level = ["-m", "noise_scale", "--noise_level", str(noise_level)] args = ["waifu2x-converter-cpp", "-j", "2", *noise_level, "-o", outfile, "-i", infile] print(" ".join(args)) -subprocess.call(args, stdout=null) +try: + subprocess.check_call(args, stdout=null) +except: + print("Failed. Check your waifu2x installation") + null.close() + sys.exit(1) null.close() print("Written to " + outfile)