Re: try-ark problem: reveal arkbase

Will Partain <[email protected]>
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
Below is what I scribbled back to Harlan's problem with no
"normalize" method in his XML-grokking machinery.

I am a bit worried that we aren't achieving the "2.0 with no
PyXML" thing.  I *thought* that's what I was using at work,
but it's possible it is too-cleverly finding some PyXML bits
that I have on the system.

Will

...........................................................
This looks like a mix-and-match-versions-of-Python-and-PyXML
thing.  We certainly haven't worked it all out (we don't
have all the combinations, after all.)

Combinations known to work include:

* Plain python 2.0/ no PyXML -- it has minidom included

* python 1.6 + PyXML 0.5.5.1

I'm *guessing* you're doing 1.6 + a newer PyXML that
includes minidom.

The code that's leading you astray is:

        try: # works for 2.0/... ?
#            import xml.dom.ext.reader.Sax
#            doc  = xml.dom.ext.reader.Sax.FromXmlStream(thing_file)
            import xml.dom.minidom
            doc  = xml.dom.minidom.parse(filename)
            root_elem = doc.documentElement
        except ImportError:
            #thing_file.close() # because we're about to reopen it
            import xml.dom.core
            import xml.dom.utils
            doc  = xml.dom.utils.FileReader().readFile(filename)
            root_elem = doc.documentElement

You're unsuspectingly succeeding on the "try" bit.
You could comment out "try...except" to make sure you get
"import xml.doc.core".

That's a *hack*; I'll need to think what the right thing to
do is.

Will

PS: The goal for Python 2.x is "no PyXML needed, just Python".
...........................................................
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.