Why exception from os.path.exists()?
On 08-06-18 04:19, Steven D'Aprano wrote:
> On Thu, 07 Jun 2018 17:45:06 +1000, Chris Angelico wrote:
>> So... an ASCIIZ string *can* contain that character, or
>> at least a representation of it. Yet it cannot contain "\0".
> You keep saying that as if it made one whit of difference to what
> os.path.exists should do. I completely agree that ASCIIZ strings cannot
> contain NUL bytes. What does that have to do with os.path.exists()?
> NTFS file systems use UTF-16 encoded strings. For typical mostly-ASCII
> pathnames, the bytes on disk are *full* of NUL bytes.
This is irrelevant. If you are on a linux box, you will still need to
pass an ASCIIZ string to the OS and won't be able to pass an embedded
NUL byte as part of a file name.
What is on the disk and what kind of remapping the OS performs to get
at the actual data, is something that happens in layer the user is
mostly not aware off.