From bd06a22fb874dcc2a51255670656afec6f5e21ea 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. --- extras/crystal.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'extras/crystal.py') diff --git a/extras/crystal.py b/extras/crystal.py index 211c13207..316fdde36 100644 --- a/extras/crystal.py +++ b/extras/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