Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: invalid literal for int() with base 10: '60.0' #91

Open
kfong257 opened this issue Feb 26, 2023 · 1 comment
Open

ValueError: invalid literal for int() with base 10: '60.0' #91

kfong257 opened this issue Feb 26, 2023 · 1 comment

Comments

@kfong257
Copy link

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"])))

@johndzxu
Copy link
Contributor

Encountered the same issue today. I just issued a pull request to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants