[issue19211] from relative_module import seems to import wrong module

2013-10-09 Thread R. David Murray
Changes by R. David Murray : -- resolution: -> invalid stage: -> committed/rejected status: open -> closed ___ Python tracker ___ __

[issue19211] from relative_module import seems to import wrong module

2013-10-09 Thread Ethan Glasser-Camp
Ethan Glasser-Camp added the comment: Thanks for the explanation. I had a feeling I was overlooking something obvious but couldn't figure out what it was. Feel free to close as invalid. -- ___ Python tracker _

[issue19211] from relative_module import seems to import wrong module

2013-10-09 Thread R. David Murray
R. David Murray added the comment: I believe that this is because once you execute the first line, 'a' exists as a name in the 'lib' namespace, so 'from . import a' sees that 'a' already exists, and does nothing. The same import sequence in abc.py will put 'a' into the 'abc' namespace, but 'f

[issue19211] from relative_module import seems to import wrong module

2013-10-09 Thread Ethan Glasser-Camp
New submission from Ethan Glasser-Camp: I have a library lib. lib/__init__.py does the following: from .subdir import a from . import a import sys print(sys.modules['lib.a']) This code fails with a KeyError. It seems that despite the second line, lib.a does not get imported. P