daterangeparser icon indicating copy to clipboard operation
daterangeparser copied to clipboard

Unable to parse date , even for simple dates given in docs

Open mohammedyunus009 opened this issue 6 years ago • 4 comments

start, end = parse("1995-2010") Traceback (most recent call last): File "", line 1, in File "/home/yunus/.conda/envs/py3-env/lib/python3.7/site-packages/daterangeparser/parse_date_range.py", line 276, in parse raise ParseException("Couldn't parse resulting datetime") pyparsing.ParseException: Couldn't parse resulting datetime (at char 0), (line:1, col:1)

mohammedyunus009 avatar Mar 09 '19 12:03 mohammedyunus009

This just started failing for me from today. It was working before. I dont know how. This isnt working on my EC2 ubuntu machine. So could be an OS issue.

chintanp avatar May 25 '19 01:05 chintanp

I've had a quick look at this, and it seems that a change in pyparsing (a library that daterangeparser uses for its parsing) has caused daterangeparser to fail.

A quick and nasty fix is to downgrade pyparsing to v2.2.2, which works (it seems to be changes in v2.3 that cause the error). You can do this by running pip install pyparsing==2.2.2.

I'll have a look into what I need to change to get it working with the latest version

robintw avatar May 26 '19 16:05 robintw

I've managed to fix this now, and have released v1.3.2 which works with the latest version of PyParsing.

Let me know if this fixes your problem.

robintw avatar May 26 '19 16:05 robintw