Get file name from file handle

L

loial

Is there anyway, having been passed a file handle, to get the
filename?

I am assuming not, but thought I would ask
 
B

bieffe62

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top