[PATCH] 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:


Vincent Legoll
diff --git a/meld b/meld
index 3b7d211..a5577a8 100755
--- a/meld
+++ b/meld
@@ -53,11 +53,23 @@ if sys.version_info[:2] < pyver:
     import pygtk
+except ImportError, e:
+    print e
+    missing_reqs("pygtk", pygtkver)
     import gtk
+except ImportError, e:
+    print e
+    print _("Cannot import: ") + "gtk"
+    sys.exit(1)
     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]