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: time data '' does not match format '%A, %d %B %Y %I:%M:%S %p' #98

Open
Krystalqx opened this issue Jul 27, 2023 · 5 comments · May be fixed by #99
Open

ValueError: time data '' does not match format '%A, %d %B %Y %I:%M:%S %p' #98

Krystalqx opened this issue Jul 27, 2023 · 5 comments · May be fixed by #99

Comments

@Krystalqx
Copy link

Describe the bug
Script showing this error message:
`ValueError: time data '' does not match format '%A, %d %B %Y %I:%M:%S %p'

Additional context
Full results:
Notion page is found. Analyzing clippings file...
'ascii' codec can't encode characters in position 0-12: ordinal not in range(128)
Found 2543 notes and highlights.

× Passed 16 bookmarks or unsupported clippings.

Initiating transfer...

Traceback (most recent call last):
File "/opt/homebrew/bin/kindle2notion", line 8, in
sys.exit(main())
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/kindle2notion/main.py", line 44, in main
export_to_notion(
File "/opt/homebrew/lib/python3.11/site-packages/kindle2notion/exporting.py", line 36, in export_to_notion
message = _add_book_to_notion(
^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/kindle2notion/exporting.py", line 90, in _add_book_to_notion
last_date = datetime.strptime(last_date, "%A, %d %B %Y %I:%M:%S %p")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%A, %d %B %Y %I:%M:%S %p'

@victorgrubio
Copy link

victorgrubio commented Aug 25, 2023

Same issue here, using Windows in this case.

@victorgrubio
Copy link

@Krystalqx I was able to find the cause of the issue in my case. The added notes were in Spanish syntax. I switched the language to English, and generated a new note. You can see the datetime format difference in the next screenshot.

Captura de pantalla 2023-08-25 083405

However, as you can see, clippings.txt does not get refactor based on Kindle's language change. Therefore, I think this library should support the different date formats Kindle has @paperboi if possible :)

If I suppress all my Spanish notes and keep the English ones, transfer is successful.

@victorgrubio victorgrubio linked a pull request Aug 25, 2023 that will close this issue
@jnsprnw
Copy link

jnsprnw commented Jan 7, 2024

I had the same problem with a german file and manually searched and replaced the dates for now.
But the pull request looks good. I could provide a german addition if that’s helpful.

@paperboi
Copy link
Owner

paperboi commented Jan 8, 2024

I had the same problem with a german file and manually searched and replaced the dates for now. But the pull request looks good. I could provide a german addition if that’s helpful.

Please do. I will include it in the next set of updates to the package.

@jnsprnw
Copy link

jnsprnw commented Jan 23, 2024

I’m currently a bit limited in time, so if anyone wants to go ahead, here are some examples from the German My Clippings.txt for testing:

Stranger Faces (Namwali Serpell)
- Ihre Markierung auf Seite 6 | bei Position 83-84 | Hinzugefügt am Mittwoch, 24. Februar 2021 14:12:02

Lorem ipsum
==========
Unsere Welt neu denken: Eine Einladung (German Edition) (Göpel, Maja)
- Ihre Markierung auf Seite 27 | bei Position 403-407 | Hinzugefügt am Sonntag, 4. April 2021 10:39:33

Lorem ipsum
==========
Unsere Welt neu denken: Eine Einladung (German Edition) (Göpel, Maja)
- Ihre Markierung auf Seite 118 | bei Position 1807-1809 | Hinzugefügt am Sonntag, 18. April 2021 06:55:37

Lorem ipsum
==========
How to Do Nothing (Jenny Odell)
- Ihre Markierung auf Seite 73 | bei Position 1107-1109 | Hinzugefügt am Donnerstag, 22. April 2021 19:08:19

Lorem ipsum
==========
Entangled Life (Merlin Sheldrake)
- Ihre Markierung auf Seite 91 | bei Position 1387-1391 | Hinzugefügt am Samstag, 15. Mai 2021 08:23:12

Lorem ipsum
==========
The Mushroom at the End of the World: On the Possibility of Life in Capitalist Ruins (Anna Lowenhaupt Tsing)
- Ihre Markierung auf Seite 6 | bei Position 86-92 | Hinzugefügt am Dienstag, 3. August 2021 07:55:49

Lorem ipsum
==========
Invisible Child (Andrea Elliott)
- Ihre Markierung auf Seite 559 | bei Position 8557-8561 | Hinzugefügt am Mittwoch, 5. Januar 2022 19:01:54

Lorem ipsum
==========
The Uninhabitable Earth (David Wallace-Wells)
- Ihre Markierung auf Seite 29 | bei Position 440-442 | Hinzugefügt am Freitag, 8. April 2022 11:43:54

Lorem ipsum
==========
Four Lost Cities (Annalee Newitz)
- Ihre Markierung auf Seite 107 | bei Position 1630-1636 | Hinzugefügt am Samstag, 4. Juni 2022 17:26:10

Lorem ipsum
==========
Yoga (Emmanuel Carrère)
- Ihre Markierung auf Seite 25 | bei Position 373-374 | Hinzugefügt am Donnerstag, 1. September 2022 12:33:25

Lorem ipsum
==========
Like a Mother (Angela Garbes)
- Ihre Markierung auf Seite 188 | bei Position 2883-2883 | Hinzugefügt am Dienstag, 13. September 2022 20:10:56

Lorem ipsum
==========
Underland: A Deep Time Journey (Robert Macfarlane)
- Ihre Markierung auf Seite 88 | bei Position 1349-1349 | Hinzugefügt am Mittwoch, 21. Juni 2023 07:37:38

Lorem ipsum
==========
Mountains of the Mind (Robert Macfarlane)
- Ihre Markierung auf Seite 160 | bei Position 2452-2457 | Hinzugefügt am Samstag, 16. September 2023 12:29:33

Lorem ipsum
==========
Islands of Abandonment (Cal Flyn)
- Ihre Markierung auf Seite 21 | bei Position 311-318 | Hinzugefügt am Montag, 25. September 2023 15:30:26

Lorem ipsum
==========
Sister Outsider (Audre Lorde)
- Ihre Markierung auf Seite 36 | bei Position 537-542 | Hinzugefügt am Samstag, 25. November 2023 22:24:09

Lorem ipsum
==========

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

Successfully merging a pull request may close this issue.

4 participants