View Single Post
Old 10-18-2020, 06:18 PM   #2
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
Posts: 1,094
Karma: 345192
Join Date: Oct 2018
Device: Kobo Aura HD
It's a bug with corrupted icon_data. See this bug (including a fix for it):

https://bugs.launchpad.net/calibre/+bug/1900299

Quote:
This is only a problem because I was tampering with the user data files (trying to rename the open with programs) - but documenting it in case similar issues come up.

Steps to replicate:

1. Add a new program to Calibre's Open With. I used Paint.NET but other programs cause the issue too. Adding an icon to an existing entry doesn't produce this issue.
2. Exit Calibre.
3. Open windows_open_with.json in Notepad++ (my usual text editor, Notepad2, just crashed). Make sure a garbled-looking icon_data entry is in the json. Immediately close the file without modifying or saving it.
4. Open Calibre again.
5. Right-click on the cover in the book info pane/window. It throws this error:

calibre, version 5.3.0
ERROR: Unhandled exception: <b>TypeError</b>:string argument without an encoding

calibre 5.3 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.19041-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (1, 6, 0) && Clean Comments (0, 1, 0) && Comments Cleaner (1, 2, 1) && Count Pages (1, 10, 0) && Drop Search Results (1, 0, 10) && Embed Comic Metadata (1, 5, 0) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (3, 24, 1) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 1) && Generate Cover (1, 5, 25) && Goodreads (1, 5, 1) && Import List (1, 5, 1) && Job Spy (1, 0, 186) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 0) && Kobo Utilities (2, 11, 8) && KoboTouchExtended (3, 4, 1) && Library Codes (1, 0, 47) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 1) && MultiColumnSearch (1, 0, 84) && Open With (1, 5, 12) && Quality Check (1, 10, 1) && Reading List (1, 6, 17) && Save To Format (0, 0, 6) && SmartEject (2, 3, 0) && View Manager (1, 5, 7)
Traceback (most recent call last):
**File "calibre\gui2\book_details.py", line 472, in contextMenuEvent
**File "calibre\gui2\book_details.py", line 339, in create_open_cover_with_menu
**File "calibre\gui2\open_with.py", line 349, in populate_menu
**File "calibre\gui2\open_with.py", line 62, in entry_to_icon_text
TypeError: string argument without an encoding

I was able to fix it by exiting Calibre, opening the file again in Notepad++, and carefully removing the corrupted icon_data from the json.

Also, I noticed that adding an icon manually doesn't produce a garbled entry - adding the icon manually only allows image files, so I suspect it may be due to getting the icon from the application binaries.

I've attached a json file with corrupted icon_data in Paint.NET. It also has a well-formed icon_data (for the Calibre 3 viewer) for comparison.
Your post is exactly the "similar issues" I was referring to.

Last edited by ownedbycats; 10-18-2020 at 06:25 PM.
ownedbycats is online now   Reply With Quote