From f9a098efe1dcfba59d8bf2026892ee65454c29b6 Mon Sep 17 00:00:00 2001 From: Johannes Gijsbers Date: Sat, 14 Aug 2004 14:51:01 +0000 Subject: Catch OSError raised when src or dst argument to os.path.samefile doesn't exist. --- Lib/shutil.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/shutil.py b/Lib/shutil.py index d361fa2..43726b4 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -27,7 +27,10 @@ def copyfileobj(fsrc, fdst, length=16*1024): def _samefile(src, dst): # Macintosh, Unix. if hasattr(os.path,'samefile'): - return os.path.samefile(src, dst) + try: + return os.path.samefile(src, dst) + except OSError: + return False # All other platforms: check for same pathname. return (os.path.normcase(os.path.abspath(src)) == -- cgit v0.12