diff options
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/site.py b/Lib/site.py index a2c0bec..46fa53a 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -138,7 +138,7 @@ def addpackage(sitedir, name, known_paths): reset = 0 fullname = os.path.join(sitedir, name) try: - f = open(fullname, "rU") + f = open(fullname, "r") except IOError: return with f: @@ -385,7 +385,7 @@ class _Printer(object): for filename in self.__files: filename = os.path.join(dir, filename) try: - fp = open(filename, "rU") + fp = open(filename, "r") data = fp.read() fp.close() break @@ -508,6 +508,11 @@ def execusercustomize(): def main(): + """Add standard site-specific directories to the module search path. + + This function is called automatically when this module is imported, + unless the python interpreter was started with the -S flag. + """ global ENABLE_USER_SITE abs_paths() @@ -526,7 +531,10 @@ def main(): if ENABLE_USER_SITE: execusercustomize() -main() +# Prevent edition of sys.path when python was started with -S and +# site is imported later. +if not sys.flags.no_site: + main() def _script(): help = """\ |