Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError on ' 16.0,2019.' #163

Open
fatkaratekid opened this issue Mar 2, 2022 · 0 comments
Open

TypeError on ' 16.0,2019.' #163

fatkaratekid opened this issue Mar 2, 2022 · 0 comments

Comments

@fatkaratekid
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant