paperboi / kindle2notion

Export all clippings from your Kindle device to a database in Notion.
https://pypi.org/project/kindle2notion/
MIT License
903 stars 120 forks source link

AttributeError: 'NoneType' object has no attribute 'strftime' #85

Open elislav opened 1 year ago

elislav commented 1 year ago

Hi! This is my first issue report, if I have missed something, just let me know.

I am on mac (m1 macbook air) and have installed the latest version of the repo and python. When I updated python with homebrew I received the following:

Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.

Warning: Ruby version 2.6.10 is unsupported on macOS 13. Homebrew
is developed and tested on Ruby 2.6.9, and may not work correctly
on other Rubies. Patches are accepted as long as they don't cause breakage
on supported Rubies.

Here is what I get when I try to sync the hightlights:

Notion page is found. Analyzing clippings file...
Found 2 notes and highlights.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/kindle2notion", line 33, in <module>
    sys.exit(load_entry_point('kindle2notion==1.0.1', 'console_scripts', 'kindle2notion')())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kindle2notion/__main__.py", line 41, in main
    all_books = parse_raw_clippings_text(all_clippings)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kindle2notion/parsing.py", line 96, in parse_raw_clippings_text
    page, location, date, isNote = _parse_page_location_date_and_note(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kindle2notion/parsing.py", line 144, in _parse_page_location_date_and_note
    date = date.strftime("%A, %d %B %Y %I:%M:%S %p")
AttributeError: 'NoneType' object has no attribute 'strftime'
paperboi commented 1 year ago

Hi, can you please post one clipping from your clippings file here? It could be that the date format in which it's stored in your device is different from the generic one I used.

elislav commented 1 year ago

That is a possible reason. My kindle is ancient :D My Clippings.txt

elislav commented 1 year ago

FYI I have used the same file with a logseq plugin and it worked. Here is a link: https://github.com/theBenForce/logseq-plugin-my-highlights

Yinkokotti commented 1 year ago

I am having the same issue unfortunately, using the first Kindle device.

Attached an example of my clippings file. My Clippings.txt

Any idea how I could solve this?