shutil.copy2 gives "SameFileError" altho files are not at all the same - why?

1.7k Views Asked by At
  File "C:\WPy64-3810\python-3.8.1.amd64\lib\shutil.py", line 239, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))

SameFileError: 'G:\\My Drive\\xxxxxxxxxxxx\\Customers (CR, Kit, & Consulting)\\xxxxx\\reports\\old drafts\\Rxxxxxxxx-1E0 (canceled pilot).doc' and 
               'G:\\Shared drives\\Studies sorted by model\\Executed - updated 2020-03-22 15h05m55s\\EAE in C57BL_6 mice, therapeutic\\MOG35-55\\Rxxxxxxxx-1E0 (canceled pilot)   xxxxx__Therapeutic EAE studies in C57BL_6 mice.doc' are the same file

What the heck is happening here?

Python 3.8, x64, Windows - the two files it prints are clearly not at all the same, yet it says "SameFileError".

I've redacted the path with "xxxxx" in a few places (these are customer files). And inserted a newline to make the source/dest filenames line up (easier to compare).

FWIW, both the source and destination filepaths are on Google Drive File Stream (G:); that may have something to do with it.

1

There are 1 best solutions below

0
On BEST ANSWER

It's a bug related to how shutil reads a Google Drive File Stream file system.

See here: https://bugs.python.org/issue33935