datefinder
datefinder copied to clipboard
Possible OverflowError from dateutil is ignored.
See https://stackoverflow.com/questions/54465029/overflowerror-when-trying-to-convert-generators-to-lists/54478879#54478879
Steps to reproduce:
>>> list(datefinder.find_dates("2019/02/01 is a date and 466990103060049 is not"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/datefinder/__init__.py", line 31, in find_dates
as_dt = self.parse_date_string(date_string, captures)
File "/usr/local/lib/python3.5/dist-packages/datefinder/__init__.py", line 101, in parse_date_string
as_dt = parser.parse(date_string, default=self.base_date)
File "/usr/local/lib/python3.5/dist-packages/dateutil/parser.py", line 1182, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/dateutil/parser.py", line 578, in parse
if cday > monthrange(cyear, cmonth)[1]:
File "/usr/lib/python3.5/calendar.py", line 121, in monthrange
day1 = weekday(year, month, 1)
File "/usr/lib/python3.5/calendar.py", line 113, in weekday
return datetime.date(year, month, day).weekday()
OverflowError: signed integer is greater than maximum
Expected result:
[datetime.datetime(2019, 2, 1, 0, 0)]
It should be noted that dateutil.parser.parse is documented as throwing this error, and so this is something datefinder should be expected to handle.
Same problem for me.
Same problem for me.
Hi @diannamcallister,
Could you post the diff of the fix that we found worked? Adding the exception catching?
Thanks! Daniel Snider ツ
On Tue, May 28, 2019 at 3:33 PM diannamcallister [email protected] wrote:
Same problem for me.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/akoumjian/datefinder/issues/100?email_source=notifications&email_token=AANIGWEUSEX76QBTNO6642TPXWCIVA5CNFSM4GTYWRUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWNGFEY#issuecomment-496657043, or mute the thread https://github.com/notifications/unsubscribe-auth/AANIGWEKE6YPSRKP2NCXTKLPXWCIVANCNFSM4GTYWRUA .