How to get a directory file descriptor?

alex23 wuwei23 at gmail.com
Tue Nov 25 12:53:10 CET 2008


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.





More information about the Python-list mailing list