All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Luis Rodriguez <mcgrof@gmail.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] crda: Throw verbose error message if M2Crypto is missing
Date: Sun, 18 Jan 2009 14:59:25 +0100	[thread overview]
Message-ID: <200901181459.25771.mb@bu3sch.de> (raw)

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@bu3sch.de>

---

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.

             reply	other threads:[~2009-01-18 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 13:59 Michael Buesch [this message]
2009-01-18 15:34 ` [PATCH] crda: Throw verbose error message if M2Crypto is missing Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901181459.25771.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.