How to get a directory file descriptor?

Terry Reedy tjreedy at
Wed Nov 26 17:02:17 CET 2008

Steve Holden wrote:

>>>>> import os
>>>>> hasattr(os, 'O_DIRECTORY')
>> True
>> I'm pretty certain it was present under Windows XP as well.

>>>> f =".", os.O_DIRECTORY)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'O_DIRECTORY'

The 3.0 manual lists 4 groups of flags: unix and windows, unix only, 
windows only, gnu only (check system-specific manual).  O_DIRECTORY  is 
in the gnu group.

More information about the Python-list mailing list