changeset 7672:523c7816c33a

Give a useful message about PYTHONPATH if startup fails
author Matt Mackall <mpm@selenic.com>
date Mon, 19 Jan 2009 16:19:09 -0600
parents 06cf09c822c4
children 4d63b10a602e
files hg
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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