Give a useful message about PYTHONPATH if startup fails
authorMatt Mackall <mpm@selenic.com>
Mon, 19 Jan 2009 16:19:09 -0600
changeset 7672 523c7816c33a
parent 7671 06cf09c822c4
child 7674 4d63b10a602e
Give a useful message about PYTHONPATH if startup fails
hg
--- a/hg	Mon Jan 19 13:20:47 2009 +0100
+++ b/hg	Mon Jan 19 16:19:09 2009 -0600
@@ -8,7 +8,14 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 # enable importing on demand to reduce startup time
-from mercurial import demandimport; demandimport.enable()
+try:
+    from mercurial import demandimport; demandimport.enable()
+except ImportError:
+    import sys
+    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
+                     ' '.join(sys.path))
+    sys.stderr.write("(check your install and PYTHONPATH)\n")
+    sys.exit(-1)
 
 import sys
 import mercurial.util