osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why exception from os.path.exists()?


On Mon, 04 Jun 2018 11:16:21 +0100, Barry Scott wrote:

[...]
> Turns out that this is a limitation on Windows as well. The \0 is not
> allowed for Windows, macOS and Posix.

We -- all of us, including myself -- have been terribly careless all 
through this discussion. The fact is, this should not be an OS limitation 
at all. It is a *file system* limitation.

If I can mount a HFS or HFS-Plus disk on Linux, it can include file names 
with embedded NULs or slashes. (Only the : character is illegal in HFS 
file names.) It shouldn't matter what the OS is, if I have drivers for 
HFS and can mount a HFS disk, I ought to be able to sensibly ask for file 
names including NUL.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson