Why exception from os.path.exists()?

Grant Edwards grant.b.edwards at gmail.com
Thu May 31 13:43:28 EDT 2018


On 2018年05月31日, Paul Moore <p.f.moore at gmail.com> wrote:
> On 31 May 2018 at 15:01, Chris Angelico <rosuav at gmail.com> wrote:
>> Can someone on Windows see if there are other path names that raise
>> ValueError there? Windows has a whole lot more invalid characters, and
>> invalid names as well.
>> On Windows:
>>>>> os.path.exists('0円')
> ValueError: stat: embedded null character in path
>>>>> os.path.exists('?')
> False
>>>>> os.path.exists('\u77412')
> False
>>>>> os.path.exists('\t')
> False
>> Honestly, I think the OP's point is correct. os.path.exists should
> simply return False if the filename has an embedded 0円 - at least on
> Unix.

Except on the platform in quetion filenames _don't_ contain an
embedded 0円. What was passed was _not_ a path/filename.
You might as well have passed a floating point number or a dict.
> Although I wouldn't consider this as anything even remotely like a
> significant issue...

Agreed, but the thread will continue for months and generate hundreds
of followup.
-- 
Grant Edwards grant.b.edwards Yow! You were s'posed
 at to laugh!
 gmail.com 


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /