Bug 809237 - failure to convert epub to pdf
failure to convert epub to pdf
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: calibre (Show other bugs)
16
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kevin Fenzi
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-02 16:00 EDT by Gabriel Somlo
Modified: 2014-03-11 18:37 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-03 23:35:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gabriel Somlo 2012-04-02 16:00:07 EDT
Description of problem:
calibre fails to convert an epub to pdf

Version-Release number of selected component (if applicable):
calibre-0.8.33-2.fc16

How reproducible:
load an epub book into calibre, then attempt to convert it to pdf

Steps to Reproduce:
1. load ebook (in .epub format) into calibre
2. click "convert books"
3. pick "pdf" as output
  
Actual results:
error message: "Exception: Empty output file, probably the conversion process crashed"

show details:

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/__init__.py", line 340, in dispatch
    self.func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/actions/convert.py", line 176, in book_converted
    raise Exception(_('Empty output file, '
Exception: Empty output file, probably the conversion process crashed

Expected results:
a pdf file should be generated

Additional info:
Comment 1 Kevin Fenzi 2012-04-02 17:08:33 EDT
Can you run it from a terminal and see if there is any further output from the conversion?

Also, can you try the latest version from my side repo and see if the problem persists?

su
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/kevin/calibre/fedora-calibre.repo
yum clean all
yum update calibre
Comment 2 Gabriel Somlo 2012-04-02 17:27:56 EDT
It spits this to the xterm I launched it from:

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/__init__.py", line 340, in dispatch
    self.func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/actions/convert.py", line 176, in book_converted
    raise Exception(_('Empty output file, '
Exception: Empty output file, probably the conversion process crashed

(mostly the same thing I got from the 'show details' GUI window...

Version 0.8.45 from your side repo crashes with an almost identical error (it's line 346 in __init.py__ instead of 340).
Comment 3 Kevin Fenzi 2012-04-03 14:43:18 EDT
Does this happen with any epub file? Or just a particular one?

If you use 'ebook-convert foo.epub foo.pdf' from the command line do you get any more output?
Comment 4 Gabriel Somlo 2012-04-04 09:06:39 EDT
I tried a second epub, and ran into the same problem. When I run ebook-convert, I get this:

$ ebook-convert example.epub example.epub example.pdf

1% Converting input to HTML...
InputFormatPlugin: EPUB Input running
on ./example.epub
Found HTML cover titlepage.xhtml
Parsing all content...
34% Running transforms on ebook...
Merging user specified metadata...
Detecting structure...
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Cleaning up manifest...
Trimming unused files from manifest...
Creating PDF Output...
67% Creating PDF Output
The cover image has an id != "cover". Renaming to work around bug in Nook Color
loaded the Generic plugin 
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/ebooks/pdf/writer.py", line 185, in _render_html
    self._render_book()
  File "/usr/lib64/calibre/calibre/ebooks/pdf/writer.py", line 151, in _render_book
    self._write()
  File "/usr/lib64/calibre/calibre/ebooks/pdf/writer.py", line 217, in _write
    outPDF = PdfFileWriter(title=self.metadata.title, author=self.metadata.author)
TypeError: __init__() got an unexpected keyword argument 'title'
Comment 5 Kevin Fenzi 2012-04-04 14:07:36 EDT
ok, this is due to calibre depending on it's own bundled pyPdf (which we don't bundle in Fedora). 

I will need to see if I can tweak it to work with the normal pyPdf, or get the changes in the Fedora pyPDF. ;(
Comment 6 Mihai Limbășan 2012-04-24 12:54:59 EDT
The main problem, as I see it, is that calibre's pyPdf version diverges considerably from upstream.

Patching it is not a matter of adjusting a few method signatures here and there - the diff from calibre's version (whichever that is, wasn't able to find out) to F16's pyPdf (1.13) runs to almost 18k. The entire pyPdf source tree, including README and setup.py and whatnot, is 84k.

I've beaten my head against this problem repeatedly for the past couple of years every time it reared its head (which was quite a few times), and unfortunately the only reasonable course of action I've found so far is to simply not drop the bundled pyPdf.

I know this suggestion runs contrary to Fedora's policy of unbundling libraries, but in this case I don't see any other reasonable choice, unless you want to fix the same class problem again and again and again every time the calibre source tree becomes incompatible with the current version of the pyPdf patch.

Should you try to do that - the necessary changes to the spec file are minimal:
  - remove the pyPdf dependency (Requires: pyPdf)
  - remove pyPdf from the list of subdirectories to be deleted from the build tree (this one's towards the end of %install, ~15 lines above %post; search for the comment "# these are provided as separate packages")
Comment 7 Mihai Limbășan 2012-04-24 12:57:53 EDT
Oh, forgot to add: Please don't get calibre's pyPdf changes into Fedora's pyPdf, the API is too different (e.g., the mail class constructor takes an additional required parameter, title) and you'll break and will have to patch every single package using pyPdf :(
Comment 8 Kevin Fenzi 2012-04-24 15:42:45 EDT
Yeah, sadly I'm all too aware of that. 

In order to bundle this, I need an exception from the fedora packaging commitee. 
I'll try and find time to request one and see what they say.
Comment 9 Mihai Limbășan 2012-05-01 10:21:44 EDT
Additional (somewhat unrelated) info:

Beginning with 0.8.49, calibre requires cssutil 0.9.9, which isn't included in Fedora 16 or 17 (and, as far as I can see, neither in rawhide.)

Patching calibre to work with the older version is, as usual, a very annoyuing chose. Should anyone want to get cssutils 0.9.9 included, you can start from this SRPM: http://rpms.limbasan.ro/fedora/16/SRPMS/python-cssutils-0.9.9-1.fc16.src.rpm
Comment 10 Kevin Fenzi 2012-05-03 23:35:41 EDT
Yeah, I filed bug 818799 to ask the maintainer to update... thanks for seeing that. 

The FPC did give me the exception to bundle pyPdf, so thats now fixed in rawhide, and will push out to other releases as they are updated. ;)
Comment 11 Mihai Limbășan 2012-05-04 00:57:29 EDT
Yay, that's very good news indeed, congratulations :)
Comment 12 tvizirov 2014-03-11 18:37:12 EDT
  Maybe a bit late, but just wanted to confirm that the current version:
calibre-1.27.0-x86_64.tar.bz2 have no problems converting files on Fedora 16. 

It can be downloaded from here: 
http://calibre-ebook.com/download_linux

$  uname -r
3.6.11-4.fc16.x86_64

Note You need to log in before you can comment on or make changes to this bug.