Traceback (most recent call last):
File "bin/analyse_error_reports", line 49, in <module>
oopstools.scripts.analyse_error_reports.main()
File "/srv/lp-oops.canonical.com/cgi-bin/lpoops/src/oopstools/scripts/analyse_error_reports.py", line 137, in main
summary.renderHTML(fp)
File "/srv/lp-oops.canonical.com/cgi-bin/lpoops/src/oopstools/oops/dbsummaries.py", line 681, in renderHTML
section.renderHTML(fp)
File "/srv/lp-oops.canonical.com/cgi-bin/lpoops/src/oopstools/oops/dbsummaries.py", line 307, in renderHTML
self._renderGroups(fp, html=True)
File "/srv/lp-oops.canonical.com/cgi-bin/lpoops/src/oopstools/oops/dbsummaries.py", line 281, in _renderGroups
group.renderHTML(fp)
File "/srv/lp-oops.canonical.com/cgi-bin/lpoops/src/oopstools/oops/dbsummaries.py", line 177, in renderHTML
% (self.count, _escape(self.etype), _escape(self.evalue)))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 78: ordinal not in range(128)
The oops that caused the error: OOPS-fc231a0a7471d55e72e091f0bcc135eb
This is a pretty simple problem.
oopstools/ oops/models. py line 153 CharField( max_length= MAX_EVALUE_ LEN)
exception_value = models.
Django deals in unicode.
oopstools/ scripts/ analyse_ error_reports. py lines 136-138 renderHTML( fp)
fp = open(options.html, 'wb')
summary.
fp.close()
Opens a file with no encoding specified.
oopstools/ oops/dbsummarie s.py lines 175-176 self.etype) , _escape( self.evalue) ))
fp.write('<div class="exc">%d <b>%s</b>: %s</div>\n'
% (self.count, _escape(
Here `_escape()` is just a dumb cgi.escape wrapper that handles '&<>' and nothing else, and returns unicode when given unicode. Any value being written that can't be coerced to ascii will throw.
Using a better means of creating html here would be nice, but just settling on an encoding and making string values written conform to it would help.