Strange import bug

Colin Brown cbrown at
Tue Nov 25 00:41:52 CET 2003

"Adeodato Simó" <asp16 at> wrote in message
news:mailman.1043.1069714565.702.python-list at
The first (default) entry in sys.path is '', which means (I think) the
current directory. So sys.path.append('./abc') appends after this entry;
then, on "import abc", python uses first '' entry, which means it looks
under current directory where it finds "abc" which gets imported *as a

Okay, but why does python not complain when it tries to import the
current directory as a module? I would expect an error, maybe:
"ImportError: xxx is not a valid python module"

If it is considered a valid python module and is executing it then who
knows what it is doing.

There is still also the question of why the prepended path option fails
in some cases under Win2K for me.

Colin Brown

More information about the Python-list mailing list