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

http://mail.gnome.org/archives/meld-list/2009-April/msg00098.html

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