Skip to content

Commit 7a0620c

Browse files
committed
Try to deal with pre-1.5.2 IOError exception objects.
1 parent 4f08e4f commit 7a0620c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/distutils/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ def setup (**attrs):
9999
except KeyboardInterrupt:
100100
raise SystemExit, "interrupted"
101101
except IOError, exc:
102-
# is this 1.5.2-specific? 1.5-specific?
103-
raise SystemExit, "error: %s: %s" % (exc.filename, exc.strerror)
102+
# arg, try to work with Python pre-1.5.2
103+
if hasattr (exc, 'filename') and hasattr (exc, 'strerror'):
104+
raise SystemExit, \
105+
"error: %s: %s" % (exc.filename, exc.strerror)
106+
else:
107+
raise SystemExit, str (exc)
104108

105109
# setup ()
106110

0 commit comments

Comments
 (0)