summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/dir_util.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/distutils/dir_util.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/distutils/dir_util.py')
-rw-r--r--Lib/distutils/dir_util.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index 92f4934..398f242 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -75,7 +75,7 @@ def mkpath (name, mode=0777, verbose=0, dry_run=0):
try:
os.mkdir(head)
created_dirs.append(head)
- except OSError, exc:
+ except OSError as exc:
raise DistutilsFileError, \
"could not create '%s': %s" % (head, exc[-1])
@@ -142,7 +142,8 @@ def copy_tree (src, dst,
"cannot copy tree '%s': not a directory" % src
try:
names = os.listdir(src)
- except os.error, (errno, errstr):
+ except os.error as e:
+ (errno, errstr) = e
if dry_run:
names = []
else:
@@ -209,7 +210,7 @@ def remove_tree (directory, verbose=0, dry_run=0):
abspath = os.path.abspath(cmd[1])
if abspath in _path_created:
del _path_created[abspath]
- except (IOError, OSError), exc:
+ except (IOError, OSError) as exc:
log.warn(grok_environment_error(
exc, "error removing %s: " % directory))