os.path.samefile is documented as:
This is determined by the device number and i-node number and raises an exception if an
os.stat()call on either pathname fails.
Which exception is raised? The other functions in
os.path explicitly document this (“Raise ValueError if …”, “Raise OSError if …” etc.)
Trying it out I get:
FileNotFoundError: [WinError 2] The system cannot find the file specified: '...'
But since this is not documented I can not rely on that? It could be a different error in some cases?
One might suggest that the answer is in the linked
os.stat() documentation. It doesn’t say anything about exceptions there either, but at the top of the
os documentation it says:
All functions in this module raise
OSErrorin the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system.
So does this also apply to
os.path.samefile? It doesn’t seem clear to me.