Get file name from file handle
bieffe62 at gmail.com
bieffe62 at gmail.com
Tue Feb 17 04:15:40 EST 2009
On Feb 17, 9:21 am, loial <jldunn2... at googlemail.com> wrote:
> Is there anyway, having been passed a file handle, to get the
> filename?
>
> I am assuming not, but thought I would ask
If by file handle you mean the object returned by 'file' and 'open'
functions, it has a name attribute.
If by file handle you mean the file descriptor, i.e. the integer used
for low level I/O, then there is no
way I know of. I believe that number is an index in an array of 'file
descriptors' somewhere inside the
C library ( below python interpreter level ), but I don't know if/how
an user program can access it.
Ciao
----
FB
More information about the Python-list
mailing list