ebook-convert from html to pdf crashes

Bug #428933 reported by akincisor
50
This bug affects 10 people
Affects Status Importance Assigned to Milestone
calibre (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Binary package hint: calibre

Ubuntu version : Karmic (9.10)
Package version : 0.6.10+dfsg-0ubuntu1

Expected : To convert html input to pdf output
What happened : ebook-convert crashed with the following output

$ ebook-convert 0-Readme.html 0-Readme.pdf
1% Converting input to HTML...
InputFormatPlugin: HTML Input running on /home/srikanth/work/projects/library-build-system/scripts/0-Readme.html
Language not specified
Creator not specified
Building file list...
34% Running transforms on ebook...
Merging user specified metadata...
Detecting structure...
        Detected chapter: E-Book Library Build System
        Detected chapter: PART I - GOALS
        Detected chapter: PART II - IMPLEMENTATION
Auto generated TOC with 7 entries.
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Cleaning up manifest...
Trimming unused files from manifest...
Creating PDF Output...
67% Creating PDF Output
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 129, in _render_html
    self._render_book()
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 104, in _render_book
    self._write()
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 140, in _write
    outPDF = PdfFileWriter(title=self.metadata.title, author=self.metadata.author)
TypeError: __init__() got an unexpected keyword argument 'title'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 85, in apport_excepthook
    if pr.check_ignored():
  File "/usr/lib/python2.6/dist-packages/apport/report.py", line 753, in check_ignored
    dom = self._get_ignore_dom()
  File "/usr/lib/python2.6/dist-packages/apport/report.py", line 714, in _get_ignore_dom
    dom = xml.dom.getDOMImplementation().createDocument(None, 'apport', None)
  File "/usr/lib/python2.6/dist-packages/cssutils/__init__.py", line 137, in createDocument
    raise NotImplementedError
NotImplementedError

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 129, in _render_html
    self._render_book()
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 104, in _render_book
    self._write()
  File "/usr/lib/python2.6/dist-packages/calibre/ebooks/pdf/writer.py", line 140, in _write
    outPDF = PdfFileWriter(title=self.metadata.title, author=self.metadata.author)
TypeError: __init__() got an unexpected keyword argument 'title'
PDF output written to /home/srikanth/work/projects/library-build-system/scripts/0-Readme.pdf
Output saved to /home/srikanth/work/projects/library-build-system/scripts/0-Readme.pdf

This happens while trying to convert any html file to pdf.

Tags: karmic lucid
tags: added: karmic
Guruprasad (lgp171188)
description: updated
tags: added: lucid
Revision history for this message
Bill Dieter (billdieter) wrote :

I see the same problem trying to convert an epub to PDF on 10.04.

Revision history for this message
Andrew Roden (andrew-roden) wrote :

This looks to be upstream, but I'm too lazy to file it. For the helpful soul that does:

/usr/lib/calibre/ebooks/pdf/writer.py

Line#206
  outPDF = PdfFileWriter(title=self.metadata.title, author=self.metadata.author)

Uses a constructor that doesn't appear to exist:
  http://pybrary.net/pyPdf/pythondoc-pyPdf.pdf.html#pyPdf.pdf.PdfFileWriter-class

Changing the line to anonymous (and only) constructor in pypdf
  outPDF = PdfFileWriter()

Resolves the bomb for me. (but I still have weird start of line chars in the result)

Revision history for this message
rodbeyer (xrodent) wrote :

calibre uses a customized pypdf.

I copied the the contents of src/pyPdf from the calibre source into /usr/share/pyshared/pyPdf/ and it works just fine.
I probably broke some pdf export somewhere else .. *shrug*

Revision history for this message
Twisted Lincoln, Inc. (twistedlincoln) wrote :

I can confirm this is still an issue in both lucid and maverick. I can also confirm that the solution from post #3 works for me.

I'm not sure this is an upstream issue -- if Calibre requires a customized version of pypdf, then it makes sense that such a customized version be provided in the repositories as an alternative to the standard pypdf -- and that this package be a dependency of Calibre's deb package.

This is a very important feature in Calibre, and to leave it not functional would be very unfortunate.

Revision history for this message
gf (gf-interlinks-deactivatedaccount) wrote :

Hello Akincisor,
Thank you for submitting this bug and reporting a problem with Calibre. You made this bug report some time ago and Ubuntu and Calibre have been updated since then.

Could you confirm that this is no longer a problem and that we can close the ticket?
If it is still a problem, are you still interested in finding a solution to this bug?
If you are, could you let us know and, in the current version, could you run the following (only once):
apport-collect 428933
and upload the updated logs and and any other logs that are relevant for this particular issue.

Thank you again for helping make Ubuntu and Calibre better.
G

Changed in calibre (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for calibre (Ubuntu) because there has been no activity for 60 days.]

Changed in calibre (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.