diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-02-12 14:14:17 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-02-12 14:14:17 (GMT) |
commit | 0166a283f65b08ee2dddb1b075f86862b8c7e3e4 (patch) | |
tree | f319f122b4865fcba24d86fd4d48f3f923cfea8b /Lib/os.py | |
parent | b071d4f3da8db02dc5b355590f1f909896592ec3 (diff) | |
download | cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.zip cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.gz cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.bz2 |
modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -232,10 +232,9 @@ def makedirs(name, mode=0o777, exist_ok=False): if head and tail and not path.exists(head): try: makedirs(head, mode, exist_ok) - except OSError as e: + except FileExistsError: # be happy if someone already created the path - if e.errno != errno.EEXIST: - raise + pass cdir = curdir if isinstance(tail, bytes): cdir = bytes(curdir, 'ASCII') |