On 25/05/2011 07:36, Ulrich Eckhardt wrote:
RVince wrote:
s = "C:\AciiCsv\Gravity_Test_data\A.csv"
f = open(s,"r")

How do I obtain the full pathname given the File, f?

Apart from the issue that the 'name' attribute is only the name used to open
the file, there is another issue, though not on the platform you're using:
Multiple directory entries can point to the same file, all of which can be
changed (including deletion!) even while you have the file open.

FWIW that's true even on Windows. (Although arguably less common).

I'm not sure what problem you're trying to solve, but I'm afraid your
approach is at least limited.

Depends on what the requirement is. If it is, essentially: "give me
at least one of the names this file had when I opened it", then this
approach is surely adequate. Certainly, things could have happened in the meantime. Obviously, only the OP can know the circumstances he's dealing with, but ISTM that far and away the most common case will
be that the file has exactly one name and that it hasn't changed.

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

Reply via email to