How to get a directory file descriptor?

alex23 wuwei23 at gmail.com
Tue Nov 25 06:56:47 EST 2008


On Nov 25, 9:53 pm, alex23 <wuwe... at gmail.com> wrote:
> On Nov 25, 5:05 pm, Cong Ma <c... at bnu.edu.cn> wrote:
>
> > Can you give me some hint on getting a directory file descriptor in Python?
> > Besides, what's good about os.fchdir() if I can't get a directory fd in the
> > first place?
>
> Try: os.open('<dirname>', os.O_RDONLY)
>
> Check os for a list of the valid flag types.

Sorry, that should probably be os.O_DIRECTORY.



More information about the Python-list mailing list