thisisparker / xword-dl

⬛⬜⬛ Command line tool to scrape crosswords from online solvers and save them as .puz files ⬛⬜⬛
MIT License
147 stars 32 forks source link

regex._regex_core.error: bad escape \d at position 7 #49

Closed primowalker closed 2 years ago

primowalker commented 2 years ago

Getting this error when trying to use the date option:

/usr/local/bin/xword-dl atl -d 8/1/2022 Traceback (most recent call last): File "/usr/local/bin/xword-dl", line 8, in sys.exit(main()) File "/usr/local/lib/python3.7/site-packages/xword_dl.py", line 1142, in main puzzle, filename = by_keyword(args.source, *options) File "/usr/local/lib/python3.7/site-packages/xword_dl.py", line 58, in by_keyword parsed_date = parse_date_or_exit(date) File "/usr/local/lib/python3.7/site-packages/xword_dl.py", line 153, in parse_date_or_exit guessed_dt = parse_date(entered_date) File "/usr/local/lib/python3.7/site-packages/xword_dl.py", line 149, in parse_date return dateparser.parse(entered_date, settings={'PREFER_DATES_FROM':'past'}) File "/usr/local/lib/python3.7/site-packages/dateparser/conf.py", line 89, in wrapper return f(args, **kwargs) File "/usr/local/lib/python3.7/site-packages/dateparser/init.py", line 54, in parse data = parser.get_date_data(date_string, date_formats) File "/usr/local/lib/python3.7/site-packages/dateparser/date.py", line 422, in get_date_data locale, date_string, date_formats, settings=self._settings) File "/usr/local/lib/python3.7/site-packages/dateparser/date.py", line 178, in parse return instance._parse() File "/usr/local/lib/python3.7/site-packages/dateparser/date.py", line 182, in _parse date_data = self._parsers[parser_name]() File "/usr/local/lib/python3.7/site-packages/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.7/site-packages/dateparser/date.py", line 235, in _get_translated_date self.date_string, keep_formatting=False, settings=self._settings) File "/usr/local/lib/python3.7/site-packages/dateparser/languages/locale.py", line 131, in translate relative_translations = self._get_relative_translations(settings=settings) File "/usr/local/lib/python3.7/site-packages/dateparser/languages/locale.py", line 158, in _get_relative_translations self._generate_relative_translations(normalize=True)) File "/usr/local/lib/python3.7/site-packages/dateparser/languages/locale.py", line 172, in _generate_relative_translations pattern = DIGIT_GROUP_PATTERN.sub(r'?P\d+', pattern) File "/usr/local/lib/python3.7/site-packages/regex/regex.py", line 702, in _compile_replacement_helper is_group, items = _compile_replacement(source, pattern, is_unicode) File "/usr/local/lib/python3.7/site-packages/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

It doesn't matter what date I use or the format of the date, or the source.

Running: MaxOS Monterey 12.5 Termal 2.12.7

rrnarayan1 commented 2 years ago

@primowalker I saw something similar - I tried the suggestion here: https://stackoverflow.com/questions/71498132/error-in-heroku-regex-regex-core-error-bad-escape-d-at-position-7-when-usin/71504213#71504213 and it resolved the issue for me.

primowalker commented 2 years ago

@rrnarayan1 . I'll give it a try. Thanks!

thisisparker commented 2 years ago

Oh sorry, late to seeing this issue but that's the same advice I just gave over in #50, and I expect it will fix the issue here too. Closing to consolidate but feel free to reopen here or comment there if you're still having issues!