View Single Post
Old 09-29-2020, 01:33 AM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
In addition to the two ur'string' instances previously mentioned...

You also need to change "from Queue import Queue" to "from queue import Queue" on line 15 of main.py (the module was renamed to lowercase).

In the same file on line 108,

Code:
with open(os.path.join(config_dir, 'dictionaries', fn), 'w') as f:
must be
Code:
with open(os.path.join(config_dir, 'dictionaries', fn), 'wb') as f:
zipfile.ZipFile('something.zip').read('a_file.txt' ) returns bytes and must therefore be written to f.write() using bytes.

I could not find anything else obviously erroring out, the plugin now loads and provides a menu of options that seem to work. On the other hand, I don't read French so I have no idea what it says, and couldn't test anything other than randomly clicking every button and checking for python runtime errors.

If there are any other errors, post them here and you're sure to find people willing to guide you in debugging it. But here's a tip when you do so: start the ebook editor from the command line, using the command:

Code:
calibre-debug -t
This will let you see the python errors, and post them for analysis. e.g. the original plugin:

Code:
  File "/home/eschwartz/git/calibre/src/calibre/gui2/tweak_book/plugin.py", line 115, in load_plugin_tools
    main = importlib.import_module(plugin.__class__.__module__+'.main')
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/home/eschwartz/git/calibre/src/calibre/customize/zipplugin.py", line 179, in load_module
    compiled = compile(code, 'calibre_plugins.%s.%s'%(plugin_name,
  File "calibre_plugins.typex.main", line 328
    reg = ur'{}'.format(kfind)
            ^
SyntaxError: invalid syntax
This pointed to the first error needing to be fixed.
Followed by

Code:
  File "/home/eschwartz/git/calibre/src/calibre/customize/zipplugin.py", line 184, in load_module
    exec(compiled, mod.__dict__)
  File "calibre_plugins.typex.main", line 15, in <module>
ModuleNotFoundError: No module named 'Queue'
Then
Code:
  File "/home/eschwartz/git/calibre/src/calibre/customize/zipplugin.py", line 179, in load_module
    compiled = compile(code, 'calibre_plugins.%s.%s'%(plugin_name,
  File "calibre_plugins.typex.jobutils", line 82
    reg = ur'{}'.format(kfind)
            ^
SyntaxError: invalid syntax
eschwartz is offline   Reply With Quote