kennethreitz / maya

Datetimes for Humans™
MIT License
3.41k stars 199 forks source link

dateparser >=0.7.5 is not compatible with Python 2.7 #188

Open thomasleveil opened 3 years ago

thomasleveil commented 3 years ago

Describe the bug

noviluni commented 3 years ago

Hi @thomasleveil

Is not "incompatibility" but something not documented: "now the Locale.translate() method only accepts Unicode strings".

To fix it, you can pin an old version of dateparser (0.7.4), but as we fixed some bugs I recommend to update this portion of code by adding .decode('utf-8').

to be:

    base = en.translate(naturaldate.decode('utf-8'), settings=dateparser.conf.settings)

instead of:

    base = en.translate(naturaldate, settings=dateparser.conf.settings)

I tried this and it seems to work. However, I didn't test it properly, so let me know if there are any issues.

Apologize for the inconvenience!

(BTW, the next dateparser version won't be supporting Python <3.5.)