Opened 8 years ago

Closed 8 years ago

#13029 closed (invalid)

Exception Value is empty with a HTMLParser.HTMLParseError

Reported by: jedie Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords: traceback
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In the settings.DEBUG Traceback page is the Exception Value empty if a HTMLParser.HTMLParseError was raised.

e.g.: Put this in a view:

    from HTMLParser import HTMLParseError
    raise HTMLParseError("FooBar Error message", (1, 2))

Normaly, the exception value should be:

FooBar Error message, at line 1, column 3

Change History (3)

comment:1 Changed 8 years ago by Karen Tracey

This appears to be a Python2.6-only problem. 2.4, 2.5, and 2.7 (alpha 2) all display a non-empty Exception Value for these exceptions. For some reason I have not tracked down, on Python 2.6.4, unicode() applied to one of these exceptions produces an empty string. On earlier Pythons we don't attempt to apply unicode() to the exception since it doesn't have a __unicode__ attribute -- we display essentially unicode(str(e)) where e is the exception. On 2.7 alpha 2 some change has been made so that unicode(e) for one of these gets routed to the HTMLParseError __str__ override. Possibly whatever change in Python that did that will also appear in the next release of 2.6, but since I haven't tracked down what change in Python is responsible for the difference I can't say that for sure.

I'm tempted to close this as invalid since it's really looking to me like a bug in Python, not Django. But these sorts of failures to display debug info are pretty annoying, so if there's something we could do to fix it in Django maybe we should. I'm just not sure what that would be.

comment:2 Changed 8 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

I'll call this accepted on the basis of Karen's remarks.

comment:3 Changed 8 years ago by Karen Tracey

Resolution: invalid
Status: newclosed

I tried this with Python 2.6.5rc1 and the problem doesn't exist there either. Based on that, I don't think it's necessary for us to put a workaround for a Python bug into Django code for this. In a couple of weeks upgrading to the latest Python 2.6 will make the problem go away.

Note: See TracTickets for help on using tickets.
Back to Top