Opened 12 years ago

Closed 11 years ago

#62 closed (wontfix)

debugging XML output gives no indication as to where in the XML the error occurred

Reported by: chaos@bbn.com Owned by: somebody
Priority: minor Milestone:
Component: Clients Version:
Keywords: v0.4.0 Cc:
Dependencies:

Description

The code:

data = gmoc.GMOCClient()
data.debugLevel = gmoc.GMOC_DEBUG_VERBOSE
...
<snip lots of object definitions>
...
data.store(pop)

yields:

Traceback (most recent call last):
  File "./report_foam_relations", line 336, in <module>
    data.store(pop)
  File "/home/chaos/gmoc.py", line 1682, in store
    print(doc.toprettyxml())
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 57, in toprettyxml
    self.writexml(writer, "", indent, newl, encoding)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1749, in writexml
    node.writexml(writer, indent, addindent, newl)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 817, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 812, in writexml
    _write_data(writer, attrs[a_name].value)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 301, in _write_data
    data = data.replace("&", "&amp;").replace("<", "&lt;")
AttributeError: 'NoneType' object has no attribute 'replace'

This gives no information about where in the XML the error was encountered. Verbose debugging should help users by giving information about where the problem was encountered.

Change History (4)

comment:1 Changed 12 years ago by chaos@bbn.com

Oh, i should have specified that when i run with debugging off, i get no output. So the exception is definitely being thrown by doc.toprettyxml(), and nothing else throws it.

Two comments:

  1. Note that this bug is about the lack of information in debugging output, not about whatever is actually causing the XML error itself, which may well be a bug, but i need to track it down, and will open a new ticket when do.
  2. Maybe a possible solution would be for verbose debugging to pretty-print intermediate versions of the document, or even just to try doing so and throw the error if it fails.

comment:2 Changed 12 years ago by Kevin Bohan

Priority: majorminor

This error was caused by the underlying Python module; I assumed that when it encountered a value of None, it would print an empty string. It doesn't do that - it throws an exception.

So, I fixed my code to make it not do that. In the long run, however, I do agree we probably need more fine-grained printing in verbose mode. I'm lowering the priority of this to 'minor', barring other major issues related to pretty printing.

comment:3 Changed 12 years ago by chaos@bbn.com

Milestone: 2012-09-04 client release

Removing this from the release milestone: sounds like we're agreed that we should do something more informative in the long term, but i don't think it's critical for now.

comment:4 Changed 11 years ago by chaos@bbn.com

Resolution: wontfix
Status: newclosed

I'm going to close this as wontfix --- basically, this is a debugging fix which helps us to find bugs in gmoc.py. The verbose printing will only be triggered when gmoc.py thinks something is valid but the XML output doesn't think so. That's not an important use case relative to actually finding and fixing user-visible bugs.

Note: See TracTickets for help on using tickets.