deepl-python icon indicating copy to clipboard operation
deepl-python copied to clipboard

[BUG] ValueError: time data does not match format

Open asfak-ur-rahman opened this issue 1 year ago • 1 comments

Hello, I have been using the DeepL (v1.18.0) to translate documents since 26/Dec/2023. But suddenly it stopped working yesterday (10/Dec/2024) after 4 am PST and our last 30 translation requests were not complete.

I have not made any changes recently. As per my investigation, I have noticed the following error in translator.get_glossary().

File "/home/guardiansofthein/py_api/helper.py", line 2222, in deepl_api_translate_doc
    my_glossary = translator.get_glossary(glossary_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/guardiansofthein/py_api/ve_py312/lib/python3.12/site-packages/deepl/translator.py", line 979, in get_glossary
    return GlossaryInfo.from_json(json)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/guardiansofthein/py_api/ve_py312/lib/python3.12/site-packages/deepl/api_data.py", line 154, in from_json
    datetime.datetime.strptime(
File "/usr/local/lib/python3.12/_strptime.py", line 554, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/_strptime.py", line 333, in _strptime
    raise ValueError("time data %r does not match format %r" %

ValueError: time data '0001-01-01T00:0000' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

I am just passing glossary_id in the get_glossary() function, but I have no control over the time data. So how can I fix this error now?

asfak-ur-rahman avatar Dec 11 '24 14:12 asfak-ur-rahman

This is due to https://github.com/DeepLcom/deepl-api-issues/issues/37

We are on it, thanks for reporting.

JanEbbing avatar Dec 11 '24 14:12 JanEbbing