View Single Post
Old 02-03-2021, 09:01 AM   #4
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,220
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
I was going to say that it worked here, but seems like I got the fixed version.

By the way:

1) The plugin seems not to handle multiple epub:type's. Ex.: epub:type="bodymatter chapter". In this case, it does not add the 'doc-chapter' role.

2) When you execute the plugin, the editor doesn't seem to notice the changes (the save buttons stays greyed out). Also, when closing, it does not ask to save, and you loose the changes.

Quote:
Originally Posted by wolf123 View Post
Thank you so much!!

There were two python3 compatibility issues. The plugin now works correctly.

If this could be useful to others, I debugged the file using 2to3
Code:
$ 2to3-2.7 main.py 
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored main.py
--- main.py	(original)
+++ main.py	(refactored)
@@ -12,7 +12,7 @@
 from calibre_plugins.access_aide.config import prefs
 
 # My modules
-from lib.stats import Stats
+from .lib.stats import Stats
 
 
 class AccessAide(Tool):
@@ -61,7 +61,7 @@
         blacklist = ['toc.xhtml']
 
         # iterate over book files
-        for name, media_type in container.mime_map.items():
+        for name, media_type in list(container.mime_map.items()):
 
             if media_type in OEB_DOCS \
                and name not in blacklist:
RefactoringTool: Files that need to be modified:
RefactoringTool: main.py
thiago.eec is offline   Reply With Quote