A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-April/119105.html below:

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

[Python-Dev] package imports, sys.path and os.chdir()Benjamin Peterson benjamin at python.org
Sat Apr 28 15:35:41 CEST 2012
2012/4/28 Nick Coghlan <ncoghlan at gmail.com>:
> On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon <brett at python.org> wrote:
>> I'm personally in favour of changing the insertion of '' to sys.path to
>> inserting the cwd when the interpreter is launched.
>
> I'm not, because it breaks importing from the interactive prompt if
> you change directory after starting the session.
>
> The existing workaround for applications is pretty trivial:
>
>  # Somewhere in your initialisation code
>  for i, entry in enumerate(sys.path):
>      sys.path[i] = os.path.abspath(i)
>
> The fix for the import system is similarly trivial: call
> os.path.abspath when calculating __file__ (just as runpy now does and
> the import emulation in pkgutil always has).

I thought __file__ was required to be absolute in Python 3.



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4