diff --git a/pretty_c14n.py b/pretty_c14n.py index f986044980f777001bc723b7d59d4f216a473b6d..d8786c4ce3e0dfc23901b045c79486a5f2482330 100755 --- a/pretty_c14n.py +++ b/pretty_c14n.py @@ -3,14 +3,14 @@ import sys from trans import pretty_c14n -def error_and_exit(x): +def error_exit(x): print('ERROR: ', str(x), file=sys.stderr) sys.exit(1) if len(sys.argv) < 3: - error_and_exit('too few arguments') + error_exit('too few arguments') if sys.argv[1] == sys.argv[2]: - error_and_exit('"infile" and "outfile" must be different') + error_exit('"infile" and "outfile" must be different') infile = sys.argv[1] outfile = sys.argv[2] @@ -21,12 +21,12 @@ try: with open(outfile, 'w') as f2: err, xml = pretty_c14n(xml) if err: - error_and_exit(xml) + error_exit(xml) f2.write(xml) except Exception as error: - error_and_exit(error) + error_exit(error) -print('\nFile »' + infile + '« was successfully canonized to file »' + \ +print('\nFile »' + infile + '« was successfully canonicalized to file »' + \ outfile + '«\n') sys.exit(0) diff --git a/trans.py b/trans.py index d2729add498e0775d528bba1314c07eaef5ca9ee..594fa199b59ebfd227fd2e98f48d839b53896eee 100644 --- a/trans.py +++ b/trans.py @@ -39,7 +39,6 @@ def cert_to_xml(cert_doc): err, xml = pretty_c14n(xml) if err: xml = '<error>' + xml + '</error>\n' - except Exception as error: xml = '<error>' + str(error) + '</error>\n'