Don't Laugh....xml package loading

Ian Oeschger oeschger at netscape.com
Fri Mar 24 13:20:41 EST 2000


May I follow up this useful advice with another question?

I just installed the xml package on my Windows98 machine, and I am having some
trouble getting Python to see some of the modules in there.

For example, when I import one of the SAX drivers using from xml.sax.drivers
import drv_sgmllib, I don't have any trouble.
from xml.parsers import sgmllib works fine, too.

However, when I try to load the xmlproc module from the package (e.g.
fromxml.parsers.xmlproc import xmlproc) I get ImportError: No module named
xmlproc.  import xml.parsers.xmlproc also fails. So does from xml.parsers import
*, though in this case because the xmlproc module is not actually loaded, not
because there is any error message.

I've got the actual DLLs in my path
The freakin' module is sitting right there in xml\parsers\xmlproc\xmlproc.pyl,
I've got my Pythonpath set up to see the xml package (at Python\Lib),
The __init__.py files at the two levels in the package both point down into
the...

...wait a second...in the parsers\__init__.py file, the parsers sitting right
there are named in the same way as the xmlproc actually sitting at
xmlproc\xmlproc.pyc...is this a problem?

__all__ = ['xmllib', 'sgmllib', 'xmlproc']

For whatever reason, I can't seem to get at this xmlproc module. Can someone
talk me through this?

Thanks a lot
Ian


Kevin Cazabon wrote:

> The problem actually is that your module isn't on the PYTHONPATH.  So, the
> python interpreter can't find it.
>
> calling it from a DOS shell, as suggested by Dana Booth, will work fine, as
> long as Python.exe is on your Windows PATH, which it should be if you used
> the installer.
>
> The other thing you can do is add the directory that your module is in to
> the PYTHONPATH... which can be done through PythonWin, or in the Windows
> registry.
>
> Kevin.
>

--
Ian Oeschger
Principal Writer, Netscape

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000324/cc541275/attachment.html>


More information about the Python-list mailing list