[meld] Make import problems easier to debug



commit f5252ff08b1312ef33eaf5868e2b3e2f9dc1e46a
Author: Vincent Legoll <vincent legoll gmail com>
Date:   Mon Apr 27 20:54:57 2009 +0200

    Make import problems easier to debug
    
    Under windows we'll see far more import problems of
    non-python-stdlib modules, for example the *gtk* family,
    that has currently to be manually installed and that require
    Path manipulations.
    
    The attached patch makes the problem more easily
    debuggable by reporting more precisely what is going on
    with import failures.
    
    I had the problem myself when trying meld on windows,
    and Lorenz suggested to do the same thing when he tried:
    
    http://mail.gnome.org/archives/meld-list/2009-April/msg00098.html
---
 meld |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/meld b/meld
index b8d2ae4..7cd92a7 100755
--- a/meld
+++ b/meld
@@ -53,11 +53,23 @@ if sys.version_info[:2] < pyver:
 try:
     import pygtk
     pygtk.require("2.0")
+except ImportError, e:
+    print e
+    missing_reqs("pygtk", pygtkver)
+
+try:
     import gtk
+except ImportError, e:
+    print e
+    print _("Cannot import: ") + "gtk"
+    sys.exit(1)
+
+try:
     import gtk.glade
 except ImportError, e:
     print e
-    missing_reqs("pygtk", pygtkver)
+    print _("Cannot import: ") + "gtk.glade"
+    sys.exit(1)
 
 if gtk.pygtk_version < pygtkver:
     missing_reqs("pygtk", pygtkver)



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