diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-11-28 21:39:04 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-11-28 21:39:04 +0000 |
commit | e8246855ff91bb1735f998417e86ee12b3ea65b5 (patch) | |
tree | 39b553e1b4e14a613dd1d197c492dc30c3364b93 /src/sbin/StatReports | |
parent | 762358a3647caa563ffede79073a0ee8edb64ca9 (diff) | |
download | bcfg2-e8246855ff91bb1735f998417e86ee12b3ea65b5.tar.gz bcfg2-e8246855ff91bb1735f998417e86ee12b3ea65b5.tar.bz2 bcfg2-e8246855ff91bb1735f998417e86ee12b3ea65b5.zip |
switch to lxml.etree errors
(Logical change 1.368)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1551 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin/StatReports')
-rw-r--r-- | src/sbin/StatReports | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/sbin/StatReports b/src/sbin/StatReports index 57ff68ef5..75409af9a 100644 --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -8,8 +8,7 @@ for bcfg2''' __revision__ = '$Revision$' from ConfigParser import ConfigParser, NoSectionError, NoOptionError -from lxml.etree import XML, XSLT, parse, Element, ElementTree, SubElement, tostring -from xml.parsers.expat import ExpatError +from lxml.etree import XML, XSLT, parse, Element, ElementTree, SubElement, tostring, XMLSyntaxError from time import asctime, strptime, time from socket import getfqdn from sys import argv @@ -87,7 +86,7 @@ def rss(reportxml, delivery, report): items = olddoc.find("channel").findall("item")[0:9] fil.close() fil = open(destination.attrib['address'], 'w') - except (IOError, ExpatError): + except (IOError, XMLSyntaxError): fil = open(destination.attrib['address'], 'w') items = [] @@ -185,22 +184,22 @@ if __name__ == '__main__': '''Reads Data & Config files''' try: statsdata = XML(open(statpath).read()) - except (IOError, ExpatError): + except (IOError, XMLSyntaxError): print("StatReports: Failed to parse %s"%(statpath)) raise SystemExit, 1 try: configdata = XML(open(configpath).read()) - except (IOError, ExpatError): + except (IOError, XMLSyntaxError): print("StatReports: Failed to parse %s"%(configpath)) raise SystemExit, 1 try: metadata = XML(open(metadatapath).read()) - except (IOError, ExpatError): + except (IOError, XMLSyntaxError): print("StatReports: Failed to parse %s"%(metadatapath)) raise SystemExit, 1 try: hostinfodata = XML(open(hostinfopath).read()) - except (IOError, ExpatError): + except (IOError, XMLSyntaxError): print("StatReports: Failed to parse %s. Is GenerateHostInfo in your path?"%(hostinfopath)) raise SystemExit, 1 |