MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Editor (https://www.mobileread.com/forums/forumdisplay.php?f=262)
-   -   Bug: TypeError While Spellcheck Sorting Language (https://www.mobileread.com/forums/showthread.php?t=339615)

Tex2002ans 05-24-2021 06:04 AM

Bug: TypeError While Spellcheck Sorting Language
 
1 Attachment(s)
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.

kovidgoyal 05-24-2021 08:33 AM

https://github.com/kovidgoyal/calibr...e689470cf69b63

Tex2002ans 05-24-2021 08:45 PM

Quote:

Originally Posted by kovidgoyal (Post 4124335)

:thumbsup::thumbsup:

Absolutely incredible turnaround time. Can't wait for latest version.


All times are GMT -4. The time now is 10:40 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.