[Python-Dev] test___all__ failing on WIndows

skip@pobox.com (Skip Montanaro) skip@pobox.com (Skip Montanaro)
Thu, 10 May 2001 09:32:15 -0500


    >> python  ../lib/test/regrtest.py test___all__
    Tim> test___all__
    Tim> test test___all__ failed -- tty has no __all__ attribute
    Tim> 1 test failed: test___all__

grumble, grumble...

    Tim> I assume this is yet another case where some excruciatingly
    Tim> non-obvious sequence of failing imports manages to leave behind a
    Tim> damaged module object in sys.modules that prevents test___all__'s
    Tim> import of tty from getting the ImportError it *ought* to get under
    Tim> Windows (and betting termios is the ultimate culprit).

I (thankfully) gave up even pretending to run Windows recently, so I can
only make a suggestion for others who look into this problem.  Try this:
Change test___all__.check_all so that the except clause reads:

    except ImportError, msg:

then print out msg when an import fails.  You should get the actual module
that failed to import.  If foo.py consists of simply "import bar", and I
import it, I see that bar couldn't be imported:

    >>> try:
    ...   import foo
    ... except ImportError, msg:
    ...   print msg
    ... 
    No module named bar

Skip