xxyzz / WordDumb

A calibre plugin that generates Kindle Word Wise and X-Ray files for KFX, AZW3, MOBI and EPUB eBook.
https://xxyzz.github.io/WordDumb/
GNU General Public License v3.0
386 stars 19 forks source link

OperationalError: no such table: senses #183

Closed west-vleteren closed 9 months ago

west-vleteren commented 9 months ago

Checkboxes

Describe the bug

The error message would show when I made the glossing language as English and disabled the wiki definition option.

Operating System name and version

macos 13.6.3

Python version

3.11

calibre version

7.4

WordDumb plugin version

3.30.0

Error message

_calibre 7.4  embedded-python: True
macOS-13.6.3-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '22.6.0', 'Darwin Kernel Version 22.6.0: Tue Nov  7 21:42:24 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_ARM64_T6020')
Python 3.11.5
OSX: ('13.6.3', ('', '', ''), 'arm64')
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (10, 0, 9) && WordDumb (3, 30, 0)
Traceback (most recent call last):
  File "calibre_plugins.worddumb.config", line 279, in open_choose_lemma_lang_dialog
    custom_lemmas_dlg = CustomLemmasDialog(
                        ^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.worddumb.custom_lemmas", line 71, in __init__
    self.init_sql_table(is_kindle)
  File "calibre_plugins.worddumb.custom_lemmas", line 87, in init_sql_table
    self.check_empty_kindle_gloss()
  File "calibre_plugins.worddumb.custom_lemmas", line 209, in check_empty_kindle_gloss
    for (gloss,) in custom_db_conn.execute("SELECT short_def FROM senses LIMIT 1"):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: senses_

Plugin settings and reproduce steps

  1. open the preference, 1 choose language, 2. both selected English, 3. none chose the Use WIKI definition option, 4. save, then message would jump out

Generated files, screenshots or videos

No response

xxyzz commented 9 months ago

The database file might not been fully downloaded, you could delete the "worddumb-lemmas" folder in the calibre plugin path and let the plugin re-download the word wise db file.

west-vleteren commented 9 months ago

The database file might not been fully downloaded, you could delete the "worddumb-lemmas" folder in the calibre plugin path and let the plugin re-download the word wise db file.

I'm glad that works, but a new trouble jump out :(

`calibre, version 7.4.0 AttributeError:'MTP_DEVICE' object has no attribute 'create_job'

calibre 7.4 embedded-python: True macOS-13.6.3-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '22.6.0', 'Darwin Kernel Version 22.6.0: Tue Nov 7 21:42:24 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_ARM64_T6020') Python 3.11.5 OSX: ('13.6.3', ('', '', ''), 'arm64') Interface language: zh_CN Successfully initialized third party plugins: DeDRM (10, 0, 9) && WordDumb (3, 30, 0) Traceback (most recent call last): File "calibre_plugins.worddumb.config", line 279, in open_choose_lemma_lang_dialog custom_lemmas_dlg = CustomLemmasDialog( ^^^^^^^^^^^^^^^^^^^ File "calibre_plugins.worddumb.custom_lemmas", line 71, in init self.init_sql_table(is_kindle) File "calibre_plugins.worddumb.custom_lemmas", line 87, in init_sql_table self.check_empty_kindle_gloss() File "calibre_plugins.worddumb.custom_lemmas", line 228, in check_empty_kindle_gloss copy_klld_from_kindle(gui.device_manager.device, custom_folder) File "calibre_plugins.worddumb.send_file", line 244, in copy_klld_from_kindle download_file_from_mtp( File "calibre_plugins.worddumb.send_file", line 307, in download_file_from_mtp device_manager.create_job( ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'MTP_DEVICE' object has no attribute 'create_job' `

west-vleteren commented 9 months ago

I used the Andriod file transfer APP to check my Kindle directory to figure out why the plugin didn't work. I found that the plugin would automatically generate a folder that used lowercase letters; when I sent the kll file to the uppercase folder, the word wise worked! You have no idea how excited I am now; I was tortured by this for a whole day. I finally fixed this, and I can enjoy the English book now :)

Thank you for your coding, but is there another way to do that? I don't wanna manually do that on each book, that would kill me.

image
xxyzz commented 9 months ago

The AttributeError is fixed in https://github.com/xxyzz/WordDumb/commit/2ae42bd56a5c50ebbc30a0aa63f64fe5a707da0d. I don't know about the lower case folder, the code never use any lower case path.

west-vleteren commented 9 months ago

Hi there, first thing, "AttributeError" was gone; thanks for the accurate work; second, now the plugin notices that my kindle needs the database file; even though kindle already got in here, the plugin still tries to download it image and the weird thing is the original file still in here; it didn't be replaced at all, image

The last thing is that the low case problem is still on; since I kept the calibre almost set as default, image I guess I stuck with this. Thank you anyway; good job.

xxyzz commented 9 months ago

The MTP download job downloads the klld file from Kindle to your mac in order to display gloss text in the customize lemmas window.

The sdr folder is created by the calibre's MTP driver, I tested this on Linux before and the folder is not in lower case. Maybe it only happens on mac?

xxyzz commented 7 months ago

https://github.com/xxyzz/WordDumb/commit/c6f85649b1792545d08cf90ce3ea2694ede9bcc3 should fix the lowercase folder bug.