[Python-Dev] package imports, sys.path and os.chdir()

Nick Coghlan ncoghlan at gmail.com
Fri Apr 27 02:39:00 CEST 2012

On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismer <tismer at stackless.com> wrote:
> No big deal and easy to work around, I just would like to understand why.

I don't like it either and want to change it, but I'm also not going
to mess with it until the importlib bootstrapping is fully integrated
and stable.

For the moment, there's a workaround in runpy to ensure at least
__main__.__file__ is always absolute (even when using the -m switch).
Longer term, I'd like to see __file__ and __path__ entries to be
guaranteed to be *always* absolutely, even when they're imported
relative to the current working directory.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list