Problem rendering research report to PDF

#1

Problem

A user reported to us having problems when exporting the research report to PDF. We are getting this stacktrace:

2019-04-17 11:08:16,210 INFO     [patzilla.navigator.services.util        ][MainThread] Starting dossier export to format "zip"
2019-04-17 11:08:16,247 ERROR    [patzilla.navigator.export               ][MainThread] Rendering dossier to PDF failed. Exception: 'ascii' codec can't encode character u'\u2605' in position 14: ordinal not in range(128)
Traceback (most recent call last):
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 224, in to_zip
    zipfile.writestr('report/@dossier.pdf', DossierXlsx(self.data).to_pdf(payload=workbook_payload))
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 690, in to_pdf
    payload = self.create()
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 499, in create
    self.write_numberlist_sheets()
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 590, in write_numberlist_sheets
    df.to_excel(self.writer, sheet_name=sheet_name, index=False)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1425, in to_excel
    startrow=startrow, startcol=startcol)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/pandas/io/excel.py", line 1487, in write_cells
    val, style)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/xlsxwriter/worksheet.py", line 64, in cell_wrapper
    return method(self, *args, **kwargs)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/xlsxwriter/worksheet.py", line 400, in write
    return self.write_url(row, col, *args)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 771, in <lambda>
    worksheet.write_url = lambda *args, **kwargs: write_url_deduce_title(worksheet, *args, **kwargs)
  File "/opt/patzilla/sites/patzilla-prod/.venv2/local/lib/python2.7/site-packages/patzilla/navigator/export.py", line 765, in write_url_deduce_title
    tip = 'Open "{name}" in Patent Navigator'.format(name=string)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2605' in position 14: ordinal not in range(128)
0 Likes

#2

Investigation

Apparently, while the Unicode black star symbol ★ called U+2605 BLACK STAR is usually used for display purposes only, it made it into the database somehow and PatZilla croaks when encountering it again while running the report generator. Bummer!

0 Likes

#3

Solution

We have finally been able to mitigate this issue [1] and make it part of the most recent release [2].

[1] Fix export with non-ascii characters accidentally slipped into patent… · ip-tools/ip-navigator@5c6aa96 · GitHub
[2] ip-navigator/CHANGES.rst at 0.165.0 · ip-tools/ip-navigator · GitHub

0 Likes