1
0
espelhamento de https://github.com/arsenetar/dupeguru.git sincronizado 2025-09-11 17:58:17 +00:00

[#47] Added debug logging to Results.load_to_xml() so that when it happens again, it's easier to figure out the cause of this

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40103
Esse commit está contido em:
hsoft 2009-08-31 15:33:44 +00:00
commit f606cc37d2

Ver arquivo

@ -7,6 +7,7 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
import logging
import re
from xml.sax import handler, make_parser, SAXException
from xml.sax.saxutils import XMLGenerator
@ -164,7 +165,20 @@ class Results(Markable):
def load_from_xml(self, infile, get_file, j=nulljob):
self.apply_filter(None)
handler = _ResultsHandler(get_file)
parser = make_parser()
try:
parser = make_parser()
except Exception as e:
# This special handling is to try to figure out the cause of #47
# We don't silently return, because we want the user to send error report.
logging.exception(e)
try:
import xml.parsers.expat
logging.warning('importing xml.parsers.expat went ok, WTF?')
except Exception as e:
# This log should give a little more details about the cause of this all
logging.exception(e)
raise
raise
parser.setContentHandler(handler)
try:
infile, must_close = open_if_filename(infile)