[Python-Dev] Looking for an "import" expert

Tim Peters tim_one@email.msn.com
Mon, 21 Aug 2000 18:30:11 -0400


> ...
> What happens is that test_getopt.py has this near the top:
>
>     from test.test_support import verbose
>
> and this is causing *another* copy of the test_support module to
> get loaded, and *its* verbose attr is 1.

Maybe adding these lines after that import will help clarify it for you
(note that you can't print to stdout without screwing up what regrtest
expects):

import sys
print >> sys.stderr, sys.modules["test_support"], \
                     sys.modules["test.test_support"]

(hot *damn* is that more pleasant than pasting stuff together by hand!).

When I run it, I get

<module 'test_support' from '..\lib\test\test_support.pyc'>
<module 'test.test_support' from
    'C:\CODE\PYTHON\DIST\SRC\lib\test\test_support.pyc'>

so they clearly are distinct modules.