Import bug...? Re: expat not found...?

Pierre Fortin pfortin at pfortin.com
Fri Jun 8 10:57:10 EDT 2001


I wrote:
[snipped]
> Compiled 2.1 on Linux Mandrake 7.2 system (incl expat)...
> 
> Yet, when I run a sample script (from
> http://www-106.ibm.com/developerworks/xml/library/l-pxml.html?open&l=912,t=grx,p=xpyth)...
> 
> xmlsaxtest.py:
>   "Simple SAX example, updated for Python 2.0+"
>   import string
>   import xml.sax
>   from xml.sax.handler import *
> 
> it won't even get past the imports...
> 
> Traceback (most recent call last):
>   File "xmlsaxtest.py", line 3, in ?
>     import xml.sax
>   File "xml.py", line 1, in ?
>     import _xmlplus.parsers.expat
> ImportError: No module named _xmlplus.parsers.expat
> 
> Probably missing something obvious/subtle; but...

YUP... subtle...

Just found that this error was caused by another test file "xml.py" in my test
directory. <SIGH>

This raises a question:  if "import foo.bar.baz" really means "foo/bar/baz...",
shouldn't import ignore any files such as ./foo.py, foo/bar.py, etc....?

Thanks,
Pierre



More information about the Python-list mailing list