timefhuman icon indicating copy to clipboard operation
timefhuman copied to clipboard

timefhuman('September 30 , 2019.')

Open wenchengxucool opened this issue 3 years ago • 1 comments


ValueError Traceback (most recent call last) /var/folders/31/7mbjndl966d92drq1zvt9t3c0000gn/T/ipykernel_34699/1205594013.py in ----> 1 timefhuman('September 30 , 2019.') 2 # datetime.datetime(2018, 8, 6, 12, 0)

~/anaconda3/lib/python3.7/site-packages/timefhuman/main.py in timefhuman(string, now, raw) 56 now = datetime.datetime.now() 57 ---> 58 tokens = timefhuman_tokens(string, now) 59 60 print(tokens)

~/anaconda3/lib/python3.7/site-packages/timefhuman/main.py in timefhuman_tokens(string, now) 75 """Convert string into timefhuman parsed, imputed, combined tokens""" 76 tokens = tokenize(string) ---> 77 tokens = categorize(tokens, now) 78 tokens = build_tree(tokens, now) 79 return tokens

~/anaconda3/lib/python3.7/site-packages/timefhuman/categorize.py in categorize(tokens, now) 32 tokens = convert_time_of_day(tokens) 33 tokens = maybe_substitute_hour_minute(tokens) ---> 34 tokens = maybe_substitute_using_date(tokens, now) 35 tokens = maybe_substitute_using_month(tokens, now) 36 tokens = substitute_hour_minute_in_remaining(tokens, now)

~/anaconda3/lib/python3.7/site-packages/timefhuman/categorize.py in maybe_substitute_using_date(tokens, now) 261 continue 262 --> 263 parts = tuple(map(int, token.split(punctuation))) 264 if len(parts) == 2: 265 day = DayToken(month=parts[0], day=parts[1], year=now.year)

ValueError: invalid literal for int() with base 10: ''

wenchengxucool avatar Dec 04 '21 11:12 wenchengxucool

Similarly: timefhuman("march 5th")

  File "<stdin>", line 1, in <module>
  File "/Users/ndemir/engineer/turbo/pyturbo/.venv/lib/python3.11/site-packages/timefhuman/main.py", line 58, in timefhuman
    tokens = timefhuman_tokens(string, now)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ndemir/engineer/turbo/pyturbo/.venv/lib/python3.11/site-packages/timefhuman/main.py", line 75, in timefhuman_tokens
    tokens = categorize(tokens, now)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ndemir/engineer/turbo/pyturbo/.venv/lib/python3.11/site-packages/timefhuman/categorize.py", line 35, in categorize
    tokens = maybe_substitute_using_month(tokens, now)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ndemir/engineer/turbo/pyturbo/.venv/lib/python3.11/site-packages/timefhuman/categorize.py", line 217, in maybe_substitute_using_month
    elif not next_next_candidate.isnumeric():
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DayToken' object has no attribute 'isnumeric'

N-Demir avatar Feb 25 '23 21:02 N-Demir