[Python-ideas] Fixing __file__ to be absolute

Tal Einat taleinat at gmail.com
Thu Jan 2 13:37:56 CET 2014


On Wed, Jan 1, 2014 at 9:01 PM, anatoly techtonik <techtonik at gmail.com> wrote:
> Fixing this thing will make my happy (or very sad if you'd like this).
>
> Problem is described here:
> http://stackoverflow.com/a/6416333/239247
> Summary:
> 1.  chdir()
> 2.  dirname(__file__)
> 3.  FAIL
>
> Proposal:
> from __future__ import abs__file__

Anatoly, this subject was already discussed on this list, just three
months ago, in a thread you started! [1]_

To quote one of Nick Coglahan's replies [2]_:

> Note that any remaining occurrences of non-absolute values in __file__ are
> generally considered bugs in the import system. However, we tend not to fix
> them in maintenance releases, since converting relative paths to absolute
> paths runs a risk of breaking user code.

> We're definitely *not* going to further pollute the module namespace with
> values that can be trivially and reliably derived from existing values.

- Tal

.. [1]: https://mail.python.org/pipermail/python-ideas/2013-September/023469.html
.. [2]: https://mail.python.org/pipermail/python-ideas/2013-September/023486.html


More information about the Python-ideas mailing list