From: Raymond Hettinger Date: Sun, 6 Oct 2002 03:52:44 +0000 (+0000) Subject: Backport 1.45: X-Git-Tag: v2.2.2b1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2f12167cb1565122cff8f33cf95fc5447c9a1f9;p=thirdparty%2FPython%2Fcpython.git Backport 1.45: Fix a problem in site.py which triggers in case sys.path is empty. Bugfix candidate for 2.2.2. --- diff --git a/Lib/site.py b/Lib/site.py index 09043a8b4a55..70f1b8b885cc 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -92,7 +92,8 @@ del dir, L # Append ./build/lib. in case we're running in the build dir # (especially for Guido :-) -if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules": +if (os.name == "posix" and sys.path and + os.path.basename(sys.path[-1]) == "Modules"): from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s)