You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes Line 161 of exporting.py will throw this error:
ValueError: invalid literal for int() with base 10: '60.0'
Full stack traceback:
Traceback (most recent call last):
File "/Users/kf25/Library/Python/3.9/bin/kindle2notion", line 8, in
sys.exit(main())
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/main.py", line 44, in main
export_to_notion(
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/exporting.py", line 36, in export_to_notion
message = _add_book_to_notion(
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/exporting.py", line 161, in _add_book_to_notion
current_clippings_count = int(str(page["Highlights"]))
ValueError: invalid literal for int() with base 10: '60.0'
Expected behaviour
No exception thrown.
Solution
Fix. Use float() to convert the decimal before converting to int.
Issue
Sometimes Line 161 of exporting.py will throw this error:
ValueError: invalid literal for int() with base 10: '60.0'
Full stack traceback:
Traceback (most recent call last):
File "/Users/kf25/Library/Python/3.9/bin/kindle2notion", line 8, in
sys.exit(main())
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/main.py", line 44, in main
export_to_notion(
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/exporting.py", line 36, in export_to_notion
message = _add_book_to_notion(
File "/Users/kf25/Library/Python/3.9/lib/python/site-packages/kindle2notion/exporting.py", line 161, in _add_book_to_notion
current_clippings_count = int(str(page["Highlights"]))
ValueError: invalid literal for int() with base 10: '60.0'
Expected behaviour
No exception thrown.
Solution
Fix. Use float() to convert the decimal before converting to int.
current_clippings_count = int(float(str(page["Highlights"])))
The text was updated successfully, but these errors were encountered: