This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: WindowsRegistryFinder never added to sys.meta_path
Type: behavior Stage: resolved
Components: Interpreter Core, Windows Versions: Python 3.3, Python 3.4, Python 3.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, brett.cannon, eric.snow, loewis, mhammond, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2014-04-21 05:04 by eric.snow, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (8)
msg216936 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-04-21 05:04
For #14578 we added WindowsRegistryFinder to importlib and try adding it to sys.meta_path during bootstrap (see bd58c421057c).

I happened to notice that in _install() in Lib/importlib/_bootstrap.py we check os.__name__.  Shouldn't it be os.name?  os.__name__ is always going to be "os"!

p.s. I'm guessing that finder doesn't get used a whole lot. ;)
msg238957 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2015-03-22 23:47
Just making sure our Windows people are aware of this issue.
msg239228 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-03-25 06:51
I've seen some module paths be registered there, but no, it doesn't really get used much (maybe because it's been broken?) os.name is certainly the right test here.

FWIW, I'd rather be prioritising file system over registry for finding packages anyway. It makes it much easier to set up app-local installs of Python (there are also conflicts between e.g. Canopy and CPython virtual environments because of the registry...). I know this is mostly getpath.c's fault and not importlib though.
msg239240 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2015-03-25 09:29
I think the main (only?) user of having sys.path entries in the registry is pywin32. It might be worth asking them if they can switch to a more mainstream approach, and then maybe the whole registry finder thing can be removed completely.
msg239266 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2015-03-25 16:15
I think they stopped using them a while back in favour of a pywin32.pth
file.

I don't think I even knew you could use the registry for sys.path.

If no-one's shouted since the changes to importlib (which was 3.3?) I
think we can quietly drop this and hope no-one notices...
msg239267 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2015-03-25 16:15
Adding Mark Hammond in case I'm wrong about the (lack of) impact on pywin32
msg239940 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2015-04-02 18:25
Turns out to be non-issue after all! I was working through the import code for other reasons and noticed that the WindowsRegistryFinder was there. I'll spare you the complications of debugging the _bootstrap part of import, but basically the code in _bootstrap.py:_setup loads the "nt" module directly instead of having it masquerade as "os" as it normally does. Therefore os.__name__ is indeed "nt" and the WindowsRegistryFinder is added to sys.meta_path
msg239947 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2015-04-02 20:48
Awesome.  Thanks Tim.
History
Date User Action Args
2022-04-11 14:58:02adminsetgithub: 65518
2015-04-02 20:48:44eric.snowsetmessages: + msg239947
2015-04-02 18:25:39tim.goldensetstatus: open -> closed
resolution: works for me
messages: + msg239940

stage: test needed -> resolved
2015-03-25 16:15:52tim.goldensetnosy: + mhammond
messages: + msg239267
2015-03-25 16:15:11tim.goldensetmessages: + msg239266
2015-03-25 09:29:19paul.mooresetnosy: + paul.moore
messages: + msg239240
2015-03-25 06:51:22steve.dowersetmessages: + msg239228
2015-03-22 23:47:10BreamoreBoysetnosy: + BreamoreBoy, tim.golden, zach.ware, steve.dower
messages: + msg238957
components: + Windows
2014-04-21 05:04:39eric.snowsetversions: + Python 3.3, Python 3.4, Python 3.5
2014-04-21 05:04:26eric.snowcreate