freeze and minidom problem

Matthew King matt at
Sat Dec 8 18:18:04 EST 2001

Hi. I'm trying to freeze a script that uses xml.dom.minidom.  I've 
compiled python 2.1.1 from source on RH 7.1 with all the modules that (I 
think) I use statically, including pyexpat. (no modules are reported 
missing at the end of freeze anyway)

The script runs fine, but after freezing I get the "No parsers found" 
exception.  Note that xml.parsers.expat in the frozen script works no 
problem.  it isn't until I try to call xml.dom.minidom.parse() that it 

In searching c.l.p, I saw some references to freeze and PyXML... So I 
installed version 0.6.6 (as a .so - haven't tried to add it to 
Modules/Setup yet).   Again unfrozen works OK, but now the frozen 
version barfs on "import xml.parsers.expat" saying that it can't find 
"parsers.expat"?  Maybe this will go away if I statically link?

In case it helps, I've included the script and output from the frozen 
executable below.

Any ideas?  Thanks in advance...

- matt

here's the script:
     s = """<?xml version="1.0"?><tag/>"""

     print "testing expat..."
     import xml.parsers.expat

     def start_element(name, attrs):
         print 'from expat:', name

     p = xml.parsers.expat.ParserCreate()
     p.StartElementHandler = start_element


     print "testing minidom"
     import xml.dom.minidom

     dom = xml.dom.minidom.parseString(s)
     node = dom.getElementsByTagName('tag')[0]
     print "from minidom:", node.nodeName

and now the output from the frozen executable (without PyXML):

testing expat...
from expat: tag
testing minidom
Traceback (most recent call last):
   File "../", line 18, in ?
     dom = xml.dom.minidom.parseString(s)
   File "/home/mking/pytest/lib/python2.1/xml/dom/", line 915, 
in parseString
     return _doparse(pulldom.parseString, args, kwargs)
   File "/home/mking/pytest/lib/python2.1/xml/dom/", line 901, 
in _doparse
     events = apply(func, args, kwargs)
   File "/home/mking/pytest/lib/python2.1/xml/dom/", line 301, 
in parseString
     parser = xml.sax.make_parser()
   File "/home/mking/pytest/lib/python2.1/xml/sax/", line 88, 
in make_parser
     raise SAXReaderNotAvailable("No parsers found", None)
xml.sax._exceptions.SAXReaderNotAvailable: No parsers found

and finally the output from the frozen executable with PyXML:

testing expat...
Traceback (most recent call last):
   File "../", line 5, in ?
     import xml.parsers.expat
ImportError: No module named parsers.expat

More information about the Python-list mailing list