--- a/utils/key2pub.py +++ b/utils/key2pub.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys try: from M2Crypto import RSA -except ImportError, e: +except ImportError as e: sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message) sys.stderr.write('Please install the "M2Crypto" Python module.\n') sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n') @@ -80,7 +80,7 @@ static struct pubkey keys[] = { ''') - for n in xrange(n + 1): + for n in range(n + 1): output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) output.write('};\n') pass @@ -117,7 +117,7 @@ static const struct key_params keys[] = { ''') - for n in xrange(n + 1): + for n in range(n + 1): output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) output.write('};\n') @@ -135,7 +135,7 @@ mode = None if not mode in modes: - print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys())) + print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))) sys.exit(2) output = open(outfile, 'w') .