Re: normalize in PyXML version hell (was: ...)

Harlan Stenn <[email protected]>
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
Will,

> Hi, Harlan et al.  This is PyXML version madness; sigh.
> What version of PyXML do you have?

I'm pretty sure I'm running Python-2.0 and PyXML-0.6.1.  Not positive on the
last bit, though.  Does python have a way to query/display the version
number of a package?

> The offending code is somewhere along here in
> ARK/arkbase/ark/xmlfile.py:
> 
>         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
> 
>         root_elem.normalize()
> 
> I'm going to *guess* that you threw an exception in the
> 'try' part (which you shouldn't have...).  Perhaps put a
> 
>     print 'here' # or 'there'
> 
> before/after the 'except ImportError', and remove all
> doubt.

I had to put the "here" line before the "try" line; the "there" line was
afater the "except" stuff:

root@dog# ./try-ark 
./try-ark: warning: this script may be overly paranoid and, um, wrong...
+ ./arkcmd package reveal --hosts=dog --verbose --use-deps=max arkbase
here
there
Traceback (most recent call last):
  File "./arkcmd", line 41, in ?
    things_mgr.doToolSubcommand()
  File "./ark/thing.py", line 153, in doToolSubcommand
    victims       = self.unpackSpecs(ark_ctrl.cmdLineNonOptions())
  File "./ark/thing.py", line 86, in unpackSpecs
    thing = self.lookup(thing_name,team_id)
  File "./ark/thing.py", line 47, in lookup
    team_id = ark.team.ACTING_TEAM().id
  File "./ark/team.py", line 23, in ACTING_TEAM
    _ActingTeam.instance = ArkTeam(acting_team_id)
  File "./ark/team.py", line 78, in __init__
    (self._is_prototype, self._xmlf) = xml_file.read(explicit_filename="%s/team.xml" % (ark.control.ArkControl().repository(team_id)))
  File "./ark/xmlfile.py", line 111, in read
    root_elem.normalize()
  File "/usr/local/lib/python2.0/site-packages/_xmlplus/dom/minidom.py", line 74, in __getattr__
    raise AttributeError, key
AttributeError: normalize
root@dog#

> Does your
> /usr/local/lib/python2.0/site-packages/_xmlplus/dom/minidom.py
> include a 'normalize' method ('def normalize(...):')?

No, not according to "grep -i".

> I'd guess either an unfriendly version of PyXML, or perhaps
> a good version misinstalled (though it doesn't look like it)...
> 
> Will
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.