Cong Ma a écrit :
Dear all,

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?

Thanks for your reply.

Regards,
Cong.

--
http://mail.python.org/mailman/listinfo/python-list


Hello,

I believe you want os.open :

Python 2.5.2 (r252:60911, Sep 29 2008, 21:10:35)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> d=os.open('mydir',os.O_RDONLY)
>>> d
3
>>> os.fchdir(d)
>>> os.getcwd()
'/home/baptiste/mydir'
>>>

Cheers,
Baptiste

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to