Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the

current directory was deleted.
This commit is contained in:
Victor Stinner 2010-10-12 22:23:23 +00:00
parent 6c314ec946
commit b103a937ea
3 changed files with 29 additions and 11 deletions

View file

@ -70,7 +70,11 @@ USER_BASE = None
def makepath(*paths):
dir = os.path.abspath(os.path.join(*paths))
dir = os.path.join(*paths)
try:
dir = os.path.abspath(dir)
except OSError:
pass
return dir, os.path.normcase(dir)
@ -81,11 +85,11 @@ def abs_paths():
continue # don't mess with a PEP 302-supplied __file__
try:
m.__file__ = os.path.abspath(m.__file__)
except AttributeError:
except (AttributeError, OSError):
pass
try:
m.__cached__ = os.path.abspath(m.__cached__)
except AttributeError:
except (AttributeError, OSError):
pass