E-book viewer: another error opening a *.chm file

Bug #1924703 reported by etc205
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

This seems to be a continuation of bug #1922503.

Trying to open the file (attached; the only difference between this one and the one attached to #1922503 is this one's name being in Russian) causes an error:

---
calibre, version 5.15.0
ERROR: Loading book failed: Failed to open the book at C:\Users\<username>\Downloads\11 - Пояснение морских терминов.chm. Click "Show details" for more info.

Failed to convert book: C:\Users\<username>\Downloads\11 - Пояснение морских терминов.chm with error:
InputFormatPlugin: CHM Input running
on C:\Users\<username>\Downloads\11 - Пояснение морских терминов.chm
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
  File "calibre\customize\ui.py", line 433, in get_file_type_metadata
  File "calibre\customize\builtins.py", line 186, in get_metadata
  File "calibre\ebooks\chm\metadata.py", line 177, in get_metadata
  File "calibre\ebooks\chm\metadata.py", line 140, in get_metadata_from_reader
  File "calibre\ebooks\chm\reader.py", line 125, in GetFile
calibre.ebooks.chm.reader.CHMError: Unable to locate '/11 - Ïîÿñíåíèå ìîðñêèõ òåðìèíîâ.htm' within CHM file 'b'C:\\Users\\<username>\\AppData\\Local\\Temp\\calibre_yr1hhusg\\4j8rkfi6_chm_metadata.chm''
Traceback (most recent call last):
  File "runpy.py", line 194, in _run_module_as_main
  File "runpy.py", line 87, in _run_code
  File "site.py", line 82, in <module>
  File "site.py", line 77, in main
  File "site.py", line 49, in run_entry_point
  File "calibre\utils\ipc\worker.py", line 197, in main
  File "<string>", line 1, in <module>
  File "calibre\srv\render_book.py", line 823, in viewer_main
  File "calibre\srv\render_book.py", line 814, in render_for_viewer
  File "calibre\srv\render_book.py", line 791, in render
  File "calibre\ebooks\oeb\iterator\book.py", line 63, in extract_book
  File "calibre\customize\conversion.py", line 245, in __call__
  File "calibre\ebooks\conversion\plugins\chm_input.py", line 57, in convert
  File "calibre\ebooks\conversion\plugins\chm_input.py", line 27, in _chmtohtml
  File "calibre\ebooks\chm\reader.py", line 49, in __init__
calibre.ebooks.chm.reader.CHMError: Unable to open CHM file 'b'C:\\Users\\<username>\\Downloads\\11 - \xd0\x9f\xd0\xbe\xd1\x8f\xd1\x81\xd0\xbd\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5 \xd0\xbc\xd0\xbe\xd1\x80\xd1\x81\xd0\xba\xd0\xb8\xd1\x85 \xd1\x82\xd0\xb5\xd1\x80\xd0\xbc\xd0\xb8\xd0\xbd\xd0\xbe\xd0\xb2.chm''
---

Calibre version: 5.15,
OS: Windows 10 Home 1803.

Revision history for this message
etc205 (etc205) wrote :
Revision history for this message
etc205 (etc205) wrote :

There's another issue; since it seems to be related to the one above, I thought I shouldn't open a new bug report.

The viewer opens the attached file, "bends.chm", but doesn't load the images. Double-clicking on the placeholder for the very first one (just below "Не пытайтесь связывать этим узлом синтетические тросы и леску: на них он ползет") causes an error dialogue to pop up:

---
calibre, version 5.15.0
ERROR: Invalid image: Failed to load the image 03 - Узлы для связывания двух тросов.files/image257.gif
---

Revision history for this message
Kovid Goyal (kovid) wrote :

Your first error is a limitation of chmlib it cant open files whose filenames are not representable in windows' mbcs encoding. This I can work around. Your second error is simply because those images are actually missing from the chm file, at least according to chmlib.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

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

Actually more precisely, the issue is there is no way to work with
binary filenames anymore in python 3 on windows. And there is no way to
get the encoding of the filenames in that chm file out of chmlib
successfuly, so image extraction will not work.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Revision history for this message
etc205 (etc205) wrote :

Both issues are fixed for me in calibre 5.16, thank you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers