Error message when opening unsupported filetypes

Bug #1845052 reported by Sondra Kinsey
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Expired
Undecided
Unassigned

Bug Description

## Summary

I tried to open a CHM file. Calibre doesn't support CHM files. That's fine, but it should display a more intelligible message explaining that filetype support is the issue, rather than the unintelligible error message that I received.

## Steps to reproduce
1. Add a Microsoft Compiled HTML Help (CHM) file to the Calibre library
2. Select the book
3. Open a context menu for the book
4. Select View/"View with calibre e-book viewer".
5. I see the following error dialog:
    ERROR: Could not open e-book: 'NoneType' object is not iterable
6. Click "Show details"
7. I see this:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/viewer/main.py", line 86, in run
    Thread.run(self)
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/calibre/calibre/ebooks/oeb/iterator/book.py", line 155, in __enter__
    ordered = [i for i in self.opf.spine if i.is_linear] + \
TypeError: 'NoneType' object is not iterable

## Environment
calibre, version 3.21.0
Ubuntu 18.04.3 LTS

Revision history for this message
Eli Schwartz (eschwartz) wrote : Re: [Bug 1845052] [NEW] Error message when opening unsupported filetypes
Download full text (3.4 KiB)

But calibre *does* support the .chm filetype, it's one of the explicitly
advertised input formats here:
https://manual.calibre-ebook.com/faq.html#what-formats-does-calibre-support-conversion-to-from

The calibre e-book viewer automatically supports all conversion formats,
in fact, internally it will actually convert these formats to the common
base representation for reading.

In the event that a format is not supported, you will instead get this
error message (try creating a dummy file called foo.sdfsdffds, which is
definitely not a supported ebook type):

calibre, version 3.99.7
ERROR: Loading book failed: Failed to open the book at foo.sdfsdffds.
Click "Show details" for more info.

Traceback (most recent call last):
  File
"/home/eschwartz/git/calibre/src/calibre/utils/ipc/simple_worker.py",
line 290, in main
    res = {'result':func(*args, **kwargs)}
  File "/home/eschwartz/git/calibre/src/calibre/srv/render_book.py",
line 614, in render
    container = Container(pathtoebook, output_dir, book_hash=book_hash,
save_bookmark_data=extract_annotations, book_metadata=mi)
  File "/home/eschwartz/git/calibre/src/calibre/srv/render_book.py",
line 180, in __init__
    book_fmt, opfpath, input_fmt = extract_book(path_to_ebook, tdir,
log=log)
  File
"/home/eschwartz/git/calibre/src/calibre/ebooks/oeb/iterator/book.py",
line 54, in extract_book
    plumber = Plumber(pathtoebook, tdir, log, view_kepub=view_kepub)
  File
"/home/eschwartz/git/calibre/src/calibre/ebooks/conversion/plumber.py",
line 755, in __init__
    raise ValueError('No plugin to handle input format: '+input_fmt)
ValueError: No plugin to handle input format: sdfsdffds

Note the last line: "no plugin to handle input format". This is a pretty
clear error message.

In fact, under Preferences, you can select CHM as one of the formats
which is permitted to be opened in the internal viewer.

Your error message is much different -- it says that the calibre e-book
viewer thought it could read the chm file, started opening it, and then
hit an internal logic error which it should never hit, freaked out, and
dumped a developer debug error.

The answer to your problem is... I don't know why you get that error,
but why are you using an ancient, end of life version 3.21.0?

I can tell you that I have just successfully tested opening a chm ebook
right now, and it worked perfectly, so clearly this "should" work.
Either something is wrong with your ancient copy of calibre, or
something is strange about your chm file.

Since you seem to be using the version of calibre from the Ubuntu
software repositories, I am going to hazard a guess that the problem is
Ubuntu's notoriously modified copy of calibre is to blame. Either that,
or whatever bug you manifested, has long been fixed. It is noteworthy
that the calibre developer does not support Linux distribution packages,
so if you cannot reproduce your error using the official binary
distribution, he will simply tell you "your distro is buggy, report a
bug to them".

Please update to the latest version of calibre, which you can obtain
from here: https://calibre-ebook.com/download_linux

If you can still produce the error using the latest prebuilt binaries,
...

Read more...

Changed in calibre:
status: New → Invalid
Revision history for this message
Sondra Kinsey (sondra.kinsey) wrote :

I was able to duplicate this problem with an updated version of calibre, although perhaps old calibre libraries installed somewhere are messing it up. However, the line numbers are now different.

New message:

calibre, version 3.48.0
ERROR: Could not open e-book: 'NoneType' object is not iterable

Traceback (most recent call last):
  File "site-packages/calibre/gui2/viewer/main.py", line 88, in run
  File "threading.py", line 754, in run
  File "site-packages/calibre/ebooks/oeb/iterator/book.py", line 161, in __enter__
TypeError: 'NoneType' object is not iterable

Changed in calibre:
status: Invalid → New
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1845052

Attach a CHM file demonstrating/reproducing the problem to this bug report. You can do that by clicking the "Add attachment or patch" link at the bottom of the bug's page. If the file you are attaching is copyrighted, mark the bug as private. You can do this by clicking the tiny yellow icon next to "This report contains Public information" in the top right area of the bug's page.

 status incomplete

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

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

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

Other bug subscribers

Remote bug watches

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