The Problem
Sorting by Language column gives this error:
Code:
TypeError: '<' not supported between instances of 'str' and 'NoneType'
I believe it's when the HTML lang has a hyphen in it.
Here's the full error:
Spoiler:
Code:
calibre, version 5.18.0
ERROR: Unhandled exception: <b>TypeError</b>:'<' not supported between instances of 'str' and 'NoneType'
calibre 5.18 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 39, 0) && Package KFX (from KFX Input) (1, 39, 0) && Diaps Editing Toolbag (0, 3, 7) && EpubMerge (2, 11, 0) && KFX metadata reader (from KFX Input) (1, 39, 0) && KFX Input (1, 39, 0) && Set KFX metadata (from KFX Output) (1, 52, 0) && KFX Output (1, 52, 0) && KePub Output (3, 4, 4) && KindleUnpack - The Plugin (0, 83, 0) && Obok DeDRM (6, 5, 4)
Traceback (most recent call last):
File "calibre\gui2\tweak_book\spell.py", line 1285, in work_done
File "calibre\gui2\tweak_book\spell.py", line 714, in set_data
File "calibre\gui2\tweak_book\spell.py", line 708, in do_sort
TypeError: '<' not supported between instances of 'str' and 'NoneType'
Calibre/OS Versions
- Calibre 5.17 + 5.18 (64-bit).
- Unsure when bug got introduced, I haven't used Calibre in quite a few versions.
- Windows 10.
Steps to Reproduce
1. Open attached EPUB.
It has a single English paragraph with some English + English (US) + English (GB):
2. Press
Tools > Check Spelling (Alt+F7).
3. Sort by the "Language" column.
4. Error pops up.
Notes
All other spellcheck columns sort fine.
If I remove "en-us" and "en-gb" and only use "en", everything sorts fine:
I stumbled across this bug as I ran it on one of my older multi-language ebooks.