[Python-ideas] 'from os.path import FILE, DIR' or internal structure of filenames

Terry Reedy tjreedy at udel.edu
Sun Sep 29 21:13:59 CEST 2013

On 9/29/2013 1:36 PM, anatoly techtonik wrote:
> On Sun, Sep 29, 2013 at 9:15 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> On 29 September 2013 13:28, INADA Naoki <songofacandy at gmail.com> wrote:
>>> os.path.abspath(__file__) returns wrong path after chdir.
>>> So I don't think abspath of module can be trivially and reliably derived
>>> from existing values.
>> Hence the part about any remaining instances of non-absolute __file__
>> values being considered a bug in the import system.
> Bug that will not be fixed, i.e. a wart.

Nick said "we tend not to fix them in maintenance releases", which I 
take to mean we can fix in new versions.

> And as a result we don't have a way to reliably reference filename
> of the current script and its directory. Hence the proposal.

The proposed addition would not happen in maintenance releases either.

Terry Jan Reedy

More information about the Python-ideas mailing list