Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
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,297
Karma: 12126329
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, 150 views)
Tex2002ans is offline   Reply With Quote
Old 05-24-2021, 07:33 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...e689470cf69b63
kovidgoyal is offline   Reply With Quote
Old 05-24-2021, 07:45 PM   #3
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,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by kovidgoyal View Post


Absolutely incredible turnaround time. Can't wait for latest version.
Tex2002ans is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Double language spellcheck not working 1v4n0 Sigil 11 01-17-2021 11:30 AM
Bug: Spellcheck Editable Count Column Tex2002ans Sigil 2 05-18-2020 10:54 AM
[Bug] Spellcheck List Cursor Location Tex2002ans Sigil 8 08-06-2018 10:53 AM
[bug] Unable to edit metadata, due to « TypeError: … … unexpected type 'Cover' » zouhzouh Calibre 4 03-04-2015 10:55 PM
Language sorting Frizzante Calibre 2 02-02-2012 03:55 PM


All times are GMT -4. The time now is 02:52 PM.


MobileRead.com is a privately owned, operated and funded community.