TypeError on ' 16.0,2019.'
fatkaratekid opened this issue · 0 comments
fatkaratekid commented
The parsing fails in this example:
Input:
list(d.find_dates(' 16.0,2019.'))
Output:
Traceback (most recent call last):
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 655, in parse
ret = self._build_naive(res, default)
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1238, in _build_naive
if cday > monthrange(cyear, cmonth)[1]:
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/calendar.py", line 124, in monthrange
raise IllegalMonthError(month)
calendar.IllegalMonthError: bad month number 16; must be 1-12
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3441, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-18-8c6e6d11b34b>", line 1, in <module>
list(d.find_dates(' 16.0,2019.'))
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/datefinder/__init__.py", line 38, in find_dates
as_dt = self.parse_date_string(date_string, captures)
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/datefinder/__init__.py", line 108, in parse_date_string
as_dt = parser.parse(
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 1374, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/home/funnyusername/anaconda3/envs/apophenator/lib/python3.8/site-packages/dateutil/parser/_parser.py", line 657, in parse
six.raise_from(ParserError(e.args[0] + ": %s", timestr), e)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Would this be expected behavior? I see in the code it should skip parsing if it cannot make anything out of it.