__file__ is sometimes absolute, sometimes relative

Antoine Pitrou solipsis at pitrou.net
Fri Oct 1 15:22:19 EDT 2010


On Fri, 1 Oct 2010 21:00:02 +0200
Sébastien Barthélemy <barthelemy at crans.org> wrote:
> Hi,
> 
> Arnaud, Christian, thank you for your help.
> 
> I'll use abspath, it's shorter.
> 
> Any idea why it's sometimes absolute, sometimes not?

AFAICT, that's because sys.path contains some absolute paths and some
relative ones.

Regards

Antoine.





More information about the Python-list mailing list