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

timefhuman('September 30 , 2019.') #26

Open
wenchengxucool opened this issue Dec 4, 2021 · 1 comment
Open

timefhuman('September 30 , 2019.') #26

wenchengxucool opened this issue Dec 4, 2021 · 1 comment

Comments

@wenchengxucool
Copy link


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: ''

@N-Demir
Copy link

N-Demir commented Feb 25, 2023

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'

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

2 participants