jensb89/Netflix-to-Trakt-Import

ValueError: time data '01/07/2023 20:15' does not match format '%d/%m/%y %H:%M'

Closed this issue · 4 comments

Teem03 commented

First off, thanks for providing this tool.

I got the Title,Date csv and was trying to kick off the process after getting the API's set up, but i'm running in an issue with the date format.

First error was
"ValueError: time data '01/07/2023 20:15' does not match format '%d.%m.%y %H:%M'"
as the Netflix csv had "/".

I tried two things, one was to reformat the document with dots, which still resulted in the following error:
"ValueError: time data '01.07.2023 20:15' does not match format '%d.%m.%y %H:%M'"

Then I tried to change the format in the config.py, which still throws an error.
Any ideas what to try next?

python netflix2trakt.py
Traceback (most recent call last):
  File "C:\Users\Coding\Netflix-to-Trakt-Import-master\NetflixTvShow.py", line 215, in addWatchedDate
    time = datetime.datetime.strptime(watchedDate + " 20:15", config.CSV_DATETIME_FORMAT + " %H:%M")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '01/07/2023 20:15' does not match format '%d/%m/%y %H:%M'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Coding\Netflix-to-Trakt-Import-master\netflix2trakt.py", line 46, in <module>
    netflixHistory.addEntry(entry, watchedAt)
  File "C:\Users\Coding\Netflix-to-Trakt-Import-master\NetflixTvShow.py", line 69, in addEntry
    self.addTvShowEntry(showName, seasonNumber, episodeTitle, entryDate)
  File "C:\Users\Coding\Netflix-to-Trakt-Import-master\NetflixTvShow.py", line 140, in addTvShowEntry
    episode.addWatchedDate(watchedDate)
  File "C:\Users\Coding\Netflix-to-Trakt-Import-master\NetflixTvShow.py", line 219, in addWatchedDate
    time = datetime.datetime.strptime(watchedDate + " 20:15", "%m.%d.%y %H:%M")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '01.07.2023 20:15' does not match format '%m.%d.%y %H:%M'

I got this error too, i really really hope it gets fixed as im slowly syncing and its painful.

"ValueError: time data '01.07.2023 20:15' does not match format '%d.%m.%y %H:%M'"

Yes, in this case, the matching format is wrong, for "2023" it must be %Y (capital Y), for 23 it's just %y (small y). Can you try to change the format in the config please? I think that will solve your issue

Teem03 commented

"ValueError: time data '01.07.2023 20:15' does not match format '%d.%m.%y %H:%M'"

Yes, in this case, the matching format is wrong, for "2023" it must be %Y (capital Y), for 23 it's just %y (small y). Can you try to change the format in the config please? I think that will solve your issue

Thanks a lot jens! I just re-ran it with an upper-case %Y in the config.py for the year and successfully loaded 7 years or Netflix history into Trakt :)

Awesome :)