From ac59ea060bb552c3a4d5243268dee287e63bfe0c Mon Sep 17 00:00:00 2001 From: giovannibajo Date: Thu, 11 Feb 2010 00:23:39 +0000 Subject: [PATCH] Avoid taking a reference to sys.path at startup. This fixes the behaviour of PyInstaller when sys.path is rebound at runtime to a different list. git-svn-id: http://svn.pyinstaller.org/trunk@770 8dd32b29-ccff-0310-8a9a-9233e24343b1 --- iu.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/iu.py b/iu.py index 27258f6..c8c6a9a 100644 --- a/iu.py +++ b/iu.py @@ -271,10 +271,7 @@ class RegistryImportDirector(ImportDirector): class PathImportDirector(ImportDirector): def __init__(self, pathlist=None, importers=None, ownertypes=None): - if pathlist is None: - self.path = sys.path - else: - self.path = pathlist + self.path = pathlist if ownertypes == None: self.ownertypes = _globalownertypes else: @@ -287,11 +284,11 @@ class PathImportDirector(ImportDirector): self.building = {} def __str__(self): - return str(self.path) + return str(self.path or sys.path) def getmod(self, nm): mod = None - for thing in self.path: + for thing in (self.path or sys.path): if isinstance(thing, STRINGTYPE): owner = self.shadowpath.get(thing, -1) if owner == -1: