Search Linux Wireless

[PATCH] crda: Throw verbose error message if M2Crypto is missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of throwing a cryptic Python backtrace, throw a better error message, if
the M2Crypto module is not installed.

Signed-off-by: Michael Buesch <mb@xxxxxxxxx>

---

diff --git a/utils/key2pub.py b/utils/key2pub.py
index 47f50e3..f8918fc 100755
--- a/utils/key2pub.py
+++ b/utils/key2pub.py
@@ -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':

-- 
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux