View Single Post
Old 05-24-2021, 05:04 AM   #1
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Bug: TypeError While Spellcheck Sorting Language

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>:'&lt;' 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):

Spoiler:
Code:
<p>This is an example of <span lang="en-us" xml:lang="en-us">color</span> and <span lang="en-gb" xml:lang="en-gb">colour</span>.</p>


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:

Spoiler:
Code:
<p>This is an example of <span lang="en" xml:lang="en">color</span> and <span lang="en" xml:lang="en">colour</span>.</p>


I stumbled across this bug as I ran it on one of my older multi-language ebooks.
Attached Files
File Type: epub Spellcheck.Lists.Language.Test.epub (1.8 KB, 183 views)
Tex2002ans is offline   Reply With Quote