Why exception from os.path.exists()?

Barry Scott barry at barrys-emacs.org
Mon Jun 11 04:10:23 EDT 2018



> On 11 Jun 2018, at 01:03, Chris Angelico <rosuav at gmail.com> wrote:
> 
> On Mon, Jun 11, 2018 at 9:52 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> On Mon, 11 Jun 2018 06:10:26 +1000, Chris Angelico wrote:
>> 
>>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
>>> I'd like to see what their file names are represented as.
>> 
>> The Finder could very easily be substituting another character, like
>> Konqueror (the KDE 3 file manager) does. In Konqueror, you can create a
>> file named "spam/ham" and it quietly substitutes "spam%2fham" instead.
>> But Konqueror's GUI treats it completely transparently: it is displayed
>> as a slash, and if you copy the file name from the GUI you get a slash.
> 
> Speculation is all very well, but I was wanting to see what actually
> happened. :)

As interesting as it is to see the way applications transform user input into
filenames its does not affect the API that python presents.

Barry




More information about the Python-list mailing list