crda: Throw verbose error message if M2Crypto is missing
PATCH 1/1 crda: Throw verbose error message if M2Crypto is missing
Instead of throwing a cryptic Python backtrace, throw a better error message, if the M2Crypto module is not installed.
Signed-off-by Michael Buesch <[email protected]>
---
utils/key2pub.py +7 -1
@@ -1,7 +1,13 @@ #!/usr/bin/env python import sys -from M2Crypto import RSA +try: + from M2Crypto import RSA +except ImportError, 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') + sys.exit(1) def print_ssl(output, name, val): while val[0] == '\0':
Signature · 1 line
Greetings, Michael.
Luis R. Rodriguez
AppliedQuoted 4 lines · Michael Buesch
Instead of throwing a cryptic Python backtrace, throw a better error message, if the M2Crypto module is not installed.
Signed-off-by Michael Buesch <[email protected]>
Thanks applied.
Luis