Bug 728749

Summary: [abrt] calibre-0.7.38-5.fc14: reader.py:168:__init__:LookupError: unknown encoding:
Product: [Fedora] Fedora Reporter: Noel Duffy <noelduffy>
Component: calibreAssignee: Kevin Fenzi <kevin>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: chkr, frankly3d, kevin, mbacovsk, nushio
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:7286494b
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-16 21:30:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
File: backtrace none

Description Noel Duffy 2011-08-07 03:02:01 UTC
abrt version: 1.1.18
architecture: x86_64
Attached file: backtrace, 2222 bytes
cmdline: python /usr/bin/calibre-parallel
component: calibre
executable: /usr/bin/calibre-parallel
kernel: 2.6.35.13-92.fc14.x86_64
package: calibre-0.7.38-5.fc14
reason: reader.py:168:__init__:LookupError: unknown encoding: 
release: Fedora release 14 (Laughlin)
time: 1312685148
uid: 500

comment
-----
I downloaded a number of ebooks from Baen's website in PRC format. One example ebook which reproduces the problem is Digital Knight, downloaded from this URL: http://www.webscription.net/p-107-digital-knight.aspx. When I selected the MOBI/Palm/Kindle format I was given a PRC file. When loaded onto a Kindle the author metadata is missing. I decided to try converting the ebook to mobi format to see if the Kindle coped with that better, but the conversion of this ebook and a number of other PRC ebooks to mobi always causes Calibre to crash.

How to reproduce
-----
1. Downloaded some ebooks in PRC format from Baen website.
2. Attempted to convert PRC to MOBI using Calibre
3. Exception in Python

Comment 1 Noel Duffy 2011-08-07 03:02:04 UTC
Created attachment 517028 [details]
File: backtrace

Comment 2 Noel Duffy 2011-08-07 03:40:06 UTC
This is the output I see in Calibre:

Unknown codepage 235802126. Assuming 
Unknown codepage 235802126. Assuming 
Traceback (most recent call last):
  File "/usr/bin/calibre-parallel", line 19, in <module>
    sys.exit(main())
  File "/usr/lib64/calibre/calibre/utils/ipc/worker.py", line 106, in main
    result = func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 24, in gui_convert
    plumber.run()
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 853, in run
    accelerators, tdir)
  File "/usr/lib64/calibre/calibre/customize/conversion.py", line 216, in __call__
    log, accelerators)
  File "/usr/lib64/calibre/calibre/ebooks/mobi/input.py", line 27, in convert
    options.debug_pipeline, try_extra_data_fix=True)
  File "/usr/lib64/calibre/calibre/ebooks/mobi/reader.py", line 295, in __init__
    user_encoding, self.log, try_extra_data_fix=try_extra_data_fix)
  File "/usr/lib64/calibre/calibre/ebooks/mobi/reader.py", line 168, in __init__
    self.title = self.title.decode(self.codec, 'replace')
LookupError: unknown encoding: 

Looking briefly at the code, the message about the unknown codepage comes from reader.py, line 143. The block looks like this:


            try:
                self.codec = {
                    1252: 'cp1252',
                    65001: 'utf-8',
                    }[self.codepage]
            except (IndexError, KeyError):
                self.codec = 'cp1252' if user_encoding is None else user_encoding
                log.warn('Unknown codepage %d. Assuming %s' % (self.codepage,
                    self.codec))

So for some reason user_encoding is empty, so self.codec is set to be empty, but when this empty value is passed to the unicode decode method on the title, it causes a crash.

Comment 3 Kevin Fenzi 2011-08-07 16:55:09 UTC
Can you try the newer version in my calibre side repo? 

su
cd /etc/yum.repos.d/
wget http://repos.fedorapeople.org/repos/kevin/calibre/fedora-calibre.repo
yum clean all
yum update calibre

This is unfortunately not the latest upstream as f14 has several components now that are too old for newer calibre versions. :(

Comment 4 Noel Duffy 2011-08-08 09:58:18 UTC
(In reply to comment #3)
> Can you try the newer version in my calibre side repo? 
> 
> su
> cd /etc/yum.repos.d/
> wget http://repos.fedorapeople.org/repos/kevin/calibre/fedora-calibre.repo
> yum clean all
> yum update calibre
> 
> This is unfortunately not the latest upstream as f14 has several components now
> that are too old for newer calibre versions. :(

Tested this new version of Calibre, it fixes the problem. I was able to convert a PRC file to MOBI without error.

Comment 5 Kevin Fenzi 2011-08-14 02:53:04 UTC
ok, good to know. Will see if it's worth a f14 update.

Comment 6 Fedora End Of Life 2012-08-16 21:30:46 UTC
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping