tempfile.mkstemp and os.fdopen

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Aug 29 03:42:19 EDT 2007


In message <Michael.J.Fromberger-8FC07C.15483428082007 at localhost>, Michael
J. Fromberger wrote:

> ... since os.fdopen() only has access to the file descriptor, it
> does not have a convenient way to obtain the file's name.

You can do this under Linux as follows:

    os.readlink("/proc/%d/fd/%d" % (os.getpid(), fileno))




More information about the Python-list mailing list