summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/tempfile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index bd0ba60..6e87af1 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -20,7 +20,11 @@ def gettempdir():
global tempdir
if tempdir is not None:
return tempdir
- attempdirs = ['/usr/tmp', '/tmp', os.getcwd(), os.curdir]
+ try:
+ pwd = os.getcwd()
+ except (AttributeError, os.error):
+ pwd = os.curdir
+ attempdirs = ['/usr/tmp', '/tmp', pwd]
if os.name == 'nt':
attempdirs.insert(0, 'C:\\TEMP')
attempdirs.insert(0, '\\TEMP')