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

Can't specify dates at all #50

Closed
fncll opened this issue Aug 12, 2022 · 2 comments
Closed

Can't specify dates at all #50

fncll opened this issue Aug 12, 2022 · 2 comments

Comments

@fncll
Copy link

fncll commented Aug 12, 2022

Greetings, I am unable to specify a date of any kind to download a puzzle. For instance, I downloaded the current universal puzzle using the command
xword-dl uni --latest

But any addition of a date, such as:
xword-dl uni --date 8/12/22
or the example in the README
xword-dl uni --date 9/22/21
or
xword-dl uni --date yesterday
etc

Fails. Here's the error output from one of them:

 xword-dl uni --date 8/10/2022
Traceback (most recent call last):
  File "/usr/local/bin/xword-dl", line 33, in <module>
    sys.exit(load_entry_point('xword-dl==2022.6.20', 'console_scripts', 'xword-dl')())
  File "/usr/local/lib/python3.10/site-packages/xword_dl-2022.6.20-py3.10.egg/xword_dl.py", line 1142, in main
  File "/usr/local/lib/python3.10/site-packages/xword_dl-2022.6.20-py3.10.egg/xword_dl.py", line 58, in by_keyword
  File "/usr/local/lib/python3.10/site-packages/xword_dl-2022.6.20-py3.10.egg/xword_dl.py", line 153, in parse_date_or_exit
  File "/usr/local/lib/python3.10/site-packages/xword_dl-2022.6.20-py3.10.egg/xword_dl.py", line 149, in parse_date
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/conf.py", line 89, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/__init__.py", line 54, in parse
    data = parser.get_date_data(date_string, date_formats)
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/date.py", line 421, in get_date_data
    parsed_date = _DateLocaleParser.parse(
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/date.py", line 178, in parse
    return instance._parse()
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/date.py", line 182, in _parse
    date_data = self._parsers[parser_name]()
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/date.py", line 196, in _try_freshness_parser
    return freshness_date_parser.get_date_data(self._get_translated_date(), self._settings)
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/date.py", line 234, in _get_translated_date
    self._translated_date = self.locale.translate(
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/languages/locale.py", line 131, in translate
    relative_translations = self._get_relative_translations(settings=settings)
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/languages/locale.py", line 158, in _get_relative_translations
    self._generate_relative_translations(normalize=True))
  File "/usr/local/lib/python3.10/site-packages/dateparser-1.0.0-py3.10.egg/dateparser/languages/locale.py", line 172, in _generate_relative_translations
    pattern = DIGIT_GROUP_PATTERN.sub(r'?P<n>\d+', pattern)
  File "/usr/local/lib/python3.10/site-packages/regex-2022.7.25-py3.10-macosx-12-x86_64.egg/regex/regex.py", line 710, in _compile_replacement_helper
    is_group, items = _compile_replacement(source, pattern, is_unicode)
  File "/usr/local/lib/python3.10/site-packages/regex-2022.7.25-py3.10-macosx-12-x86_64.egg/regex/_regex_core.py", line 1737, in _compile_replacement
    raise error("bad escape \\%s" % ch, source.string, source.pos)
regex._regex_core.error: bad escape \d at position 7
@thisisparker
Copy link
Owner

Hmm I haven't seen this error before! I am able to reproduce, but only if I manually upgrade the package regex (an alternative implementation of the built-in regular expressions model) to the most recent version, as it seems you have installed. regex is a dependency of the dateparser package I use for parsing passed dates, so that makes enough sense.

It looks like dateparser has pinned the version of regex it takes to be earlier than the version 2022.3.15, according to this change. For now, you should be able to fix it by changing your installed version to the most recent version before that date, with pip install regex==2022.3.2. Try that and let me know if it fixes the issue?

@fncll
Copy link
Author

fncll commented Aug 23, 2022

That did it! Thank you!

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