Newbie Python+XML Question

Jeff Layton laytonjb at bellsouth.net
Wed Mar 6 19:34:29 EST 2002


Brian Quinlan wrote:

> Jeff wrote:
> > % python2.1 testg.py
> > Traceback (most recent call last):
> >   File "testg.py", line 26, in ?
> >     class XmlHandler(saxutils.DefultHandler):
> > AttributeError: 'xml.sax.saxutils' module has no attribute
> 'DefultHandler'
> >
> >    It looks like the SAX stuff is not getting imported correctly.
> > Does anyone feel like helping a lowly Newbie with this one?
>
> Easy one: you spelled "Default" incorrectly. Change 'DefultHandler' to
> 'DefaultHandler' everywhere in that script.

OK, got that one fixes :) I still get an error message:

[laytonj at home2 GANGLIA]$ python2.1 testg.py
Traceback (most recent call last):
  File "testg.py", line 26, in ?
    class XmlHandler(saxutils.DefaultHandler):
AttributeError: 'xml.sax.saxutils' module has no attribute 'DefaultHandler'


Just for completness, here's the top part of the code:

#

import socket
import getopt
import string
import xml.sax
#import xml.sax.saxutils
from xml.sax import saxutils
import sys


class XmlHandler(saxutils.DefaultHandler):

        def __init__(self, argv, machines=[]):
                saxutils.DefultHandler.__init__(self)
                self.info = {}
                self.hostname = ''
                self.max_hostname_len = 0
                self.metrics = {}
                self.machines = machines


Any thoughts? Ideas?

Thanks!

Jeff


>
>
> Cheers,
> Brian





More information about the Python-list mailing list