Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13645 closed defect (cantfix)

AttributeError: ParaFrag instance has no attribute 'underline'

Reported by: Massimo Owned by: Álvaro Iradier
Priority: normal Component: TracWikiPrintPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

This is Trac 1.2.3 I just installed the TracWikiPrintPlugin without any configuration and received:

 Trac detected an internal error:

AttributeError: ParaFrag instance has no attribute 'underline'

Is there any minimal configuration I need to produce a PDF export?

File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 647, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 248, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib64/python2.7/site-packages/trac/wiki/web_ui.py", line 182, in process_request
  format, versioned_page.name)
File "/usr/lib64/python2.7/site-packages/trac/mimeview/api.py", line 1048, in send_converted
  iterable=iterable)
File "/usr/lib64/python2.7/site-packages/trac/mimeview/api.py", line 725, in convert_content
  conversion.key)
File "build/bdist.linux-x86_64/egg/wikiprint/wikiprint.py", line 462, in convert_content
  date=format_datetime(to_datetime(None)))
File "build/bdist.linux-x86_64/egg/wikiprint/wikiprint.py", line 298, in html_to_pdf
  link_callback=loader.getFileName)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/xhtml2pdf/document.py", line 134, in pisaDocument
  doc.multiBuild(context.story)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1143, in multiBuild
  self.build(tempStory, **buildKwds)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1056, in build
  self.handle_flowable(flowables)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 912, in handle_flowable
  if frame.add(f, canv, trySplit=self.allowSplitting):
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/frames.py", line 217, in _add
  flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/tableofcontents.py", line 287, in drawOn
  self._table.drawOn(canvas, x, y, _sW)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/flowables.py", line 114, in drawOn
  self._drawOn(canvas)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/flowables.py", line 95, in _drawOn
  self.draw()#this is the bit you overload
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/tables.py", line 1466, in draw
  self._drawCell(cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight))
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/tables.py", line 1600, in _drawCell
  v.drawOn(self.canv,x,y)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/flowables.py", line 114, in drawOn
  self._drawOn(canvas)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/platypus/flowables.py", line 95, in _drawOn
  self.draw()#this is the bit you overload
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/xhtml2pdf/reportlab_paragraph.py", line 1148, in draw
  self.drawPara(self.debug)
File "/mnt/data/trac/.local/lib64/python2.7/site-packages/xhtml2pdf/reportlab_paragraph.py", line 1553, in drawPara
  if f.underline or f.link or f.strike:

Attachments (0)

Change History (7)

comment:1 Changed 5 years ago by Jun Omae

Resolution: cantfix
Status: newclosed

That's an xhtml2pdf issue. Try to downgrade reportlab to 3.4.

See xhtml2pdf is not compatible with reportlab 3.5.x · Issue #404 · xhtml2pdf/xhtml2pdf.

comment:2 Changed 5 years ago by Massimo

I tried:

$ pip2.7 uninstall reportlab
Uninstalling reportlab-3.5.32:
  Would remove:
    /mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab-3.5.32.dist-info/*
    /mnt/data/trac/.local/lib64/python2.7/site-packages/reportlab/*
Proceed (y/n)? y
  Successfully uninstalled reportlab-3.5.32

$ pip2.7 install --user reportlab-x
Collecting reportlab-x
  Downloading https://files.pythonhosted.org/packages/f3/c4/d2f1fa1d16a901217f3cb547b1b4b4a22e8e82971fdad959ab88c2aa6c8c/reportlab-x-3.4.0.2.tar.gz (1.7MB)
     |████████████████████████████████| 1.7MB 1.5MB/s 
Requirement already satisfied: pillow>=2.4.0 in /mnt/data/trac/.local/lib64/python2.7/site-packages (from reportlab-x) (6.2.1)
Requirement already satisfied: pip>=1.4.1 in /usr/lib64/python2.7/site-packages (from reportlab-x) (19.3.1)
Requirement already satisfied: setuptools>=2.2 in /usr/lib64/python2.7/site-packages (from reportlab-x) (41.5.1)
Installing collected packages: reportlab-x
    Running setup.py install for reportlab-x ... done
Successfully installed reportlab-x-3.4.0.2

But now I get:

2019-11-12 13:46:19,088 Trac[loader] DEBUG: Skipping "TracWikiPrintPlugin 2.0.0.dev0": DistributionNotFound: The 'reportlab>=3.0' distribution was not found and is required by xhtml2pdf

comment:3 Changed 5 years ago by anonymous

Why you're installing reportlab-x? That should be reportlab.

comment:4 Changed 5 years ago by Massimo

Because I thought this is the name for the 3.4 version you mentioned. How do I install the right version?

$ pip2.7 search reportlab |grep reportlab
reportlab (3.5.32)               - The Reportlab Toolkit
reportlab-flexbox (0.0.4)        - FlexBox for reportlab
reportlab-x (3.4.0.2)            - The Reportlab Toolkit
some-reportlab-snippets (0.0.0)  - description
reportlab2 (3.5.27)              - The Reportlab Toolkit
autobasedoc (1.1.3)              - autobasedoc - convenience reportlab tool
pypdfml (0.1.0alpha)             - Simple XML wrapper for reportlab.
nbconvert_reportlab (0.2)        - Convert notebooks to PDF using Reportlab
edc-reports (0.1.22)             - Report classes using reportlab for clinicedc/edc projects
fedex-invoice (1.0.1)            - Fedex Commercial Invoice generator, invoice templating using reportlab

comment:5 Changed 5 years ago by Ryan J Ollos

$ pip install reportlab < 3.5

comment:6 Changed 5 years ago by Massimo

I did, but now pip check complains about missing reportlab:

$ pip install --user "reportlab < 3.5"
Collecting reportlab<3.5
  Downloading https://files.pythonhosted.org/packages/7c/f8/b9aac1adf90d79b8a38b25462dcbaff03486817f15184604d4818b170941/reportlab-3.4.0-cp36-cp36m-manylinux1_x86_64.whl (3.7MB)
     |████████████████████████████████| 3.7MB 1.8MB/s 
Requirement already satisfied: pillow>=2.4.0 in ./.local/lib64/python3.6/site-packages (from reportlab<3.5) (6.2.1)
Requirement already satisfied: setuptools>=2.2 in /usr/lib64/python3.6/site-packages (from reportlab<3.5) (41.5.1)
Requirement already satisfied: pip>=1.4.1 in /usr/lib64/python3.6/site-packages (from reportlab<3.5) (19.3.1)
Installing collected packages: reportlab
  Found existing installation: reportlab 3.5.32
    Uninstalling reportlab-3.5.32:
      Successfully uninstalled reportlab-3.5.32
Successfully installed reportlab-3.4.0

$ pip2.7 check
xhtml2pdf 0.2.3 requires reportlab, which is not installed.

comment:7 in reply to:  6 Changed 5 years ago by Jun Omae

$ pip install --user "reportlab < 3.5"

Use pip2.7.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Álvaro Iradier.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.