loial <jldunn2...@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 you mean a Python file object then file.name (but it may not exist on all file objects).
If you mean a system file handle, then which filename would you like? On many filesystems the file exists independantly from the filenames, so a single file can have many names or none at all. On Linux you can use os.fstat() to get the inode number for the file but I think you would have to scan the relevant directories to find the names associated with the inode. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list