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/2010-February/097468.html below:

[Python-Dev] __file__ is not always an absolute path

[Python-Dev] __file__ is not always an absolute path [Python-Dev] __file__ is not always an absolute pathChristian Heimes lists at cheimes.de
Sun Feb 7 01:04:27 CET 2010
Guido van Rossum wrote:
> What we do instead, is code in site.py that walks over the elements of
> sys.path and turns them into absolute paths. However this code runs
> before '' is inserted in the front of sys.path, so that the initial
> value of sys.path is ''.
> 
> You may want to print the value of sys.path at various points to see
> for yourself.

I ran into the issue on Debian or Ubuntu (can't remember) several years
ago. The post-install script of the Python package did something like
"cd /usr/lib/pythonX.Y && ./compileall.py", so all pyc files were
created relative to the library root of Python. The __file__ attribute
of all pre-compiled Python files were relative, too.

Christian
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