From 84fc578838bdf1a4f3f51b5ec6a6b758acf69507 Mon Sep 17 00:00:00 2001 From: C Nelson Date: Fri, 6 Apr 2012 13:12:30 -0500 Subject: Making generate_diff_insert python2.7 compatible. original-commit-id: bd06a22fb874dcc2a51255670656afec6f5e21ea --- crystal.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crystal.py b/crystal.py index 211c132..316fdde 100644 --- a/crystal.py +++ b/crystal.py @@ -5835,14 +5835,17 @@ def generate_diff_insert(line_number, newline, debug=False): newfile_fh.write(newfile) newfile_fh.close() + try: + from subprocess import CalledProcessError + except ImportError: + CalledProcessError = None + try: diffcontent = subprocess.check_output("diff -u ../main.asm " + newfile_filename, shell=True) - except AttributeError, exc: + except (AttributeError, CalledProcessError): p = subprocess.Popen(["diff", "-u", "../main.asm", newfile_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() diffcontent = out - except Exception, exc: - raise exc os.system("rm " + original_filename) os.system("rm " + newfile_filename) -- cgit v1.2.3