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

Index out of range #4

Open
esemeniuc opened this issue Jul 11, 2019 · 3 comments
Open

Index out of range #4

esemeniuc opened this issue Jul 11, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@esemeniuc
Copy link

esemeniuc commented Jul 11, 2019

When running timefhuman('last wednesday of july'), I get the following error:

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from timefhuman import timefhuman
>>> timefhuman('last wednesday of july')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/main.py", line 58, in timefhuman
    tokens = timefhuman_tokens(string, now)
  File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/main.py", line 75, in timefhuman_tokens
    tokens = categorize(tokens, now)
  File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/categorize.py", line 35, in categorize
    tokens = maybe_substitute_using_month(tokens, now)
  File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/categorize.py", line 193, in maybe_substitute_using_month
    next_candidate = tokens[index+1]
IndexError: list index out of range
>>> 

Platform: Ubuntu 18.04 x64, installed using pip3

Also happens with timefhuman('last wednesday in july')

@alvinwan
Copy link
Owner

@esemeniuc Thanks for reporting! The parser is looking for "last " and reaches the end of the string without finding a day of week. I'll mark this as a feature request.

@alvinwan alvinwan added the enhancement New feature or request label Jul 13, 2019
@Avi-avidan
Copy link

I also got this error when trying to run
timefhuman('last day of december')
or
timefhuman('last week of november')

so +1 for this feature request.

@alvinwan
Copy link
Owner

Thanks for reporting -- this will be helpful the next chance I get to work on this.

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

No branches or pull requests

3 participants