Skip to content

Getting KeyError issues #1291

@bferreira

Description

@bferreira

Hi,

We have been getting this errors once in a while. If we run the same process gain it works. Any thing you can advise us on?
There is always a different KeyError code everytime and it happens with different dates at different times of day.

Traceback (most recent call last):
  File "/app/composer/parse/components/plot.py", line 63, in from_yaml
    legend_name = dateparser.parse(legend_date[0]).strftime(legend_date[1])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/conf.py", line 100, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/__init__.py", line 79, in parse
    data = parser.get_date_data(date_string, date_formats)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/date.py", line 517, in get_date_data
    for locale in self._get_applicable_locales(date_string):
  File "/usr/local/lib/python3.11/site-packages/dateparser/date.py", line 576, in _get_applicable_locales
    if self._is_applicable_locale(locale, s):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/date.py", line 589, in _is_applicable_locale
    return locale.is_applicable(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/languages/locale.py", line 73, in is_applicable
    return dictionary.are_tokens_valid(date_tokens)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/languages/dictionary.py", line 136, in are_tokens_valid
    match_relative_regex = self._get_match_relative_regex_cache()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dateparser/languages/dictionary.py", line 317, in _get_match_relative_regex_cache
    self._construct_match_relative_regex()
  File "/usr/local/lib/python3.11/site-packages/dateparser/languages/dictionary.py", line 324, in _construct_match_relative_regex
    self._get_sorted_relative_strings_from_cache()
  File "/usr/local/lib/python3.11/site-packages/dateparser/languages/dictionary.py", line 281, in _get_sorted_relative_strings_from_cache
    return self._sorted_relative_strings_cache[self._settings.registry_key][
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '86f0601c4589570a9b883f716c3e92b3'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions