Re: ARK CVS problem?

Will Partain <[email protected]>
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
Harlan reports:

> The latest CVS ARK gives me: [snip
> 
>   File "/usr/local/lib/python2.0/site-packages/_xmlplus/dom/pulldom.py", line 171, in getEvent
>     buf=self.stream.read(self.bufsize)
> AttributeError: read

The problem is we didn't fold anything back into the sources
from the last time you asked this question :-(  I sent the
message below, but my recollection is that we settled on
something more drastic; do you have that?

Anyway, it's our old friend python-version-vs-PyXML-version.
If you can duplicate what you did to fix it last time, could
you send me your xmlfile.py thereafter?

Will

============================================================
Sigh.  Well, there comes a time when you have to get out a
big stick and hit it.  See if dropping this block into
xmlfile.py does the trick:

        try: # should work for 2.0 with PyXML 0.6.2+
            import xml.dom.minidom
            doc  = xml.dom.minidom.parse(filename)
            root_elem = doc.documentElement
            if not hasattr(root_elem,'normalize'):
                # oops... smell 0.6.1 or something....
                raise 'bad dom'
        except ImportError:
            # this is probably something like Python 1.5.2/1.6
            # with PyXML 0.5.5.1.  Or *something*.
            import xml.dom.core
            import xml.dom.utils
            doc  = xml.dom.utils.FileReader().readFile(filename)
            root_elem = doc.documentElement
        except 'bad dom':
            # this ought to be Python 2.0 with PyXML 0.6.1 or
	    # thereabouts.
            import xml.dom.ext.reader.Sax
            thing_file = open(filename)
            doc  = xml.dom.ext.reader.Sax.FromXmlStream(thing_file)
            root_elem = doc.documentElement
	    thing_file.close() # because we're about to reopen it

	root_elem.normalize()

Let me know how you get on.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.