paperboi / kindle2notion

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

AttributeError: 'str' object has no attribute 'removeprefix' #21

Closed VatanaChhorn closed 3 years ago

VatanaChhorn commented 3 years ago

I'm tryna running the script, but this error log has occurred.

python3 kindle2notion.py Notion page is found. Analyzing clippings file...

Found 328 notes and highlights.

'str' object has no attribute 'removeprefix' Exiting script... sh: pause: command not found

paperboi commented 3 years ago

Hey, thanks for bringing this up! Please check if your Python version is upto date. str.removeprefix() and str.removesuffix() functions are supported from v3.9 onwards.

VatanaChhorn commented 3 years ago

I've worked it out!

Thanks for bare with me, and keep up the good work ; )

VatanaChhorn commented 3 years ago

btw, do I need to create a new workspace every time I export the highlights to Notion, or the code is automatically ignoring the duplicate highlight?

paperboi commented 3 years ago

btw, do I need to create a new workspace every time I export the highlights to Notion, or the code is automatically ignoring the duplicate highlight?

So the code checks for new highlights by comparing the total number of clippings under each book with the number of highlights listed on its respective Notion page. And replace the entire text under that page with the updated clippings. I did this to save the number of API calls. You would only have to create the workspace and set up the environment vars once. You may need to update your Notion token every couple months tho, which is normal. Hope this helps. Check out the code and let me know if it works out. Cheers!