From 884afd92f5a194e326df2be8279d4ab160c7b0c9 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Wed, 10 Dec 2014 02:50:32 +0200 Subject: Issue #21775: shutil.copytree(): fix crash when copying to VFAT An exception handler assumed that that OSError objects always have a 'winerror' attribute. That is not the case, so the exception handler itself raised AttributeError when run on Linux (and, presumably, any other non-Windows OS). Patch by Greg Ward. --- Lib/shutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/shutil.py') diff --git a/Lib/shutil.py b/Lib/shutil.py index 22958f4204..ac06ae5e6c 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -337,7 +337,7 @@ def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, copystat(src, dst) except OSError as why: # Copying file access times may fail on Windows - if why.winerror is None: + if getattr(why, 'winerror', None) is None: errors.append((src, dst, str(why))) if errors: raise Error(errors) -- cgit v1.2.1