Why exception from os.path.exists()?

Paul Moore p.f.moore at gmail.com
Sat Jun 2 07:41:57 EDT 2018


On 2 June 2018 at 12:28, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Jun 2, 2018 at 9:13 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> On Sat, 02 Jun 2018 20:58:43 +1000, Chris Angelico wrote:
>>
>>>>> Windows isn't POSIX compliant.
>>>>
>>>> Technically, Windows is POSIX compliant. You have to turn off a bunch
>>>> of features, turn on another bunch of features, and what you get is the
>>>> bare minimum POSIX compliance possible, but it's enough to tick the
>>>> check box for POSIX compliance.
>>>
>>> Really? I didn't know that Windows path names were POSIX compliant. Or
>>> do you have to use the Cygwin fudge to count Windows as POSIX? And what
>>> about POSIX signal handling?
>>>
>>> Citation needed, big-time.
>>
>> https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem
>>
>> https://technet.microsoft.com/en-us/library/bb463220.aspx
>>
>> https://brianreiter.org/2010/08/24/the-sad-history-of-the-microsoft-posix-
>> subsystem/
>
> Can someone confirm whether or not all the listed signals are actually
> supported? We know that Ctrl-C maps to the internal Windows interrupt
> handler, and "kill process" maps to the internal Windows "terminate",
> but can you send a different process all the different signals and
> handle them differently?
>
> I also can't find anything about path names there. What does POSIX say
> about the concept of relative paths? Does Windows comply with that?
>
> "Windows has some features which are compatible with the equivalent
> POSIX features" is not the same as "Technically, Windows is POSIX
> compliant".

My apologies, I don't have time to hunt out complete references now,
but my recollection is that Windows (the OS) is POSIX compliant (as
noted, with certain configurations, etc). However, the Win32 API
(which is what most people think of when they say "Windows") is not
POSIX compatible. As an example, Windows (the kernel) has the
capability to implement fork(), but this isn't exposed via the Win32
API. To implement fork() you need to go to the raw kernel layer. Which
is basically what the Windows Linux subsystem (bash on Windows 10)
does - it's a user-level implementation of the POSIX API using Win32
kernel calls.

Paul



More information about the Python-list mailing list