How to get a directory file descriptor?

alex23 wuwei23 at gmail.com
Tue Nov 25 23:02:13 EST 2008


On Nov 26, 1:34 pm, Cong Ma <c... at mail.bnu.edu.cn> wrote:
> So if I can't seem to get directory file descriptors, the only way to use
> os.fchdir() in Python is to embed Python in C code?

This doesn't work for you?

import os
dirfd = os.open("directory-name", os.O_DIRECTORY)
os.fchdir(dirfd)

Are you getting errors? Incorrect behaviour?



More information about the Python-list mailing list