View Single Post
Old 09-16-2021, 02:07 AM   #982
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by lsacher View Post
Long time user of Calibre, but now I want to import annotations. I tried your SampleExportingApp modified to use your highlight example. Using a mockup epub of the "John Smith" book, I get as far as the Import Annotations pop-up showing all the correct info including the 3 annotations. But then I get error messages: Unable to import annotations from SampleExportingApp -and- UnboundLocalError:local variable 'updated_annorations' referenced before assignment. The console log shows:

File "calibre_plugins.annotations.annotations", line 165, in to_HTML
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'
-and-
File "calibre_plugins.annotations.action", line 1057, in present_annotated_books
UnboundLocalError: local variable 'updated_annotations' referenced before assignment.

I'm using Windows 10 10.0.19041 [64bit] and calibre 5.27 [64bit]

Attached are the my actions, debug console listing and the mockup epub
Those errors look like they are coming from the Annotations plugin. Which does have a "SampleExportingApp.py" supplied with it. That is sample code for creating an extra method of importing annotations. This is used for ereader applications that do annotations and have function to export the annotations to a file. The SampleExportingApp.py file contains the sample for a new source of annotations. You would need to modify this to support the format of the file you are importing. The errors above are because no annotations were found when using this.
davidfor is offline   Reply With Quote