eliascotto / export-kobo

A Python tool to export annotations and highlights from a Kobo SQLite file. Now with web UI.
MIT License
24 stars 2 forks source link

Kobo export produces an error #1

Closed chris-jelly closed 1 year ago

chris-jelly commented 2 years ago

Export to markdown produces an error

When attempting to export to markdown format, I get the below AttributeError for NoneType.

I hope to take a closer look at the code as well to see if I can figure out the issue

Command run

python3 export-kobo.py ~/kobo/KoboReader.sqlite --markdown

Traceback

Traceback (most recent call last):
  File "export-kobo.py", line 541, in <module>
    main()
  File "export-kobo.py", line 537, in main
    ExportKobo().run()
  File "export-kobo.py", line 84, in run
    self.actual_command()
  File "export-kobo.py", line 404, in actual_command
    items = self.read_items(books)
  File "export-kobo.py", line 501, in read_items
    items = [Item(d) for d in self.query(self.QUERY_ITEMS)]
  File "export-kobo.py", line 501, in <listcomp>
    items = [Item(d) for d in self.query(self.QUERY_ITEMS)]
  File "export-kobo.py", line 129, in __init__
    self.text = values[1].strip().rstrip()
AttributeError: 'NoneType' object has no attribute 'strip'

Notes

It looks like the value of values[1] is null.

Next plan is to open up the sqlite db and take a look at the queries/schema to see if there's an issue there.

chris-jelly commented 2 years ago

Could be an issue with my sqlite db - not all entries have this field empty.

Shall take a look when I've got time and update further.

choc96208 commented 2 years ago

I also get this error with the 1.1 release.

python export-kobo.py KoboReader.sqlite
Traceback (most recent call last):
  File "export-kobo/export-kobo.py", line 541, in <module>
    main()
  File "export-kobo/export-kobo.py", line 537, in main
    ExportKobo().run()
  File "export-kobo/export-kobo.py", line 84, in run
    self.actual_command()
  File "export-kobo/export-kobo.py", line 404, in actual_command
    items = self.read_items(books)
  File "export-kobo/export-kobo.py", line 501, in read_items
    items = [Item(d) for d in self.query(self.QUERY_ITEMS)]
  File "export-kobo/export-kobo.py", line 501, in <listcomp>
    items = [Item(d) for d in self.query(self.QUERY_ITEMS)]
  File "export-kobo/export-kobo.py", line 129, in __init__
    self.text = values[1].strip().rstrip()
AttributeError: 'NoneType' object has no attribute 'strip'

The old code from 2020 (or thereabouts) still works though. Not sure which repository I got it from.

eliascotto commented 1 year ago

Thanks for pointing it out. It has been resolved now.