[New-bugs-announce] [issue32699] pythonXY._pth : unclear how .pth files are handled
report at bugs.python.org
Sun Jan 28 13:51:50 EST 2018
New submission from Thomas Kluyver <thomas at kluyver.me.uk>:
Nicholas Tollervey has been getting Pynsist to use the new pythonXY._pth file to assemble sys.path. However, I'm not clear on how this behaves with .pth files. The docs on this (https://docs.python.org/3/using/windows.html#finding-modules ) appear to contradict themselves:
> site is not imported unless one line in the file specifies import site
> Note that .pth files (without leading underscore) will be processed normally by the site module.
I can see two possibilities:
1. .pth files are processed normally if and only if the ._pth file specifies 'import site'. If it doesn't, they are ignored.
2. If a .pth file is encountered, site is imported to process it, but with sys.flags.nosite set, so that site doesn't do the normal stuff on import.
Some packages unfortunately seem to depend on .pth files getting processed, so if 1. is the case, Pynsist needs to ensure site is loaded.
nosy: steve.dower, takluyver
title: pythonXY._pth : unclear how .pth files are handled
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce