summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2008-10-05 09:00:28 (GMT)
committerMark Hammond <mhammond@skippinet.com.au>2008-10-05 09:00:28 (GMT)
commitd12dcaea3ed9f476df0831f02631eb586a251e2d (patch)
tree959e0ab006f9978eeb483b023e1f1d45a628e6a4 /Lib
parente5384b08861edde56d0b280f5993766d309ab4d0 (diff)
downloadcpython-d12dcaea3ed9f476df0831f02631eb586a251e2d.zip
cpython-d12dcaea3ed9f476df0831f02631eb586a251e2d.tar.gz
cpython-d12dcaea3ed9f476df0831f02631eb586a251e2d.tar.bz2
Fix [issue4038] py3k error in distutils file_copy exception handlers. r=martin.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/file_util.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py
index 6919060..b46b0da 100644
--- a/Lib/distutils/file_util.py
+++ b/Lib/distutils/file_util.py
@@ -30,31 +30,27 @@ def _copy_file_contents(src, dst, buffer_size=16*1024):
try:
fsrc = open(src, 'rb')
except os.error as e:
- (errno, errstr) = e
- raise DistutilsFileError("could not open '%s': %s" % (src, errstr))
+ raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror))
if os.path.exists(dst):
try:
os.unlink(dst)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not delete '%s': %s" % (dst, errstr))
+ "could not delete '%s': %s" % (dst, e.strerror))
try:
fdst = open(dst, 'wb')
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not create '%s': %s" % (dst, errstr))
+ "could not create '%s': %s" % (dst, e.strerror))
while True:
try:
buf = fsrc.read(buffer_size)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not read from '%s': %s" % (src, errstr))
+ "could not read from '%s': %s" % (src, e.strerror))
if not buf:
break
@@ -62,9 +58,8 @@ def _copy_file_contents(src, dst, buffer_size=16*1024):
try:
fdst.write(buf)
except os.error as e:
- (errno, errstr) = e
raise DistutilsFileError(
- "could not write to '%s': %s" % (dst, errstr))
+ "could not write to '%s': %s" % (dst, e.strerror))
finally:
if fdst:
fdst.close()