BoboTiG / ebook-reader-dict

Finally decent dictionaries based on Wiktionary for your beloved eBook reader. Daily updates & 13 languages supported so far.
http://www.tiger-222.fr/?d=2020/04/17/22/14/21-un-dictionnaire-alternatif-et-complet-pour-votre-liseuse
MIT License
403 stars 24 forks source link

Multiple issues in scripts #1785

Closed BoboTiG closed 1 year ago

BoboTiG commented 1 year ago

en-langs.py needs to be updated again :)

Traceback (most recent call last):
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/en-langs.py", line 94, in <module>
    mres: Dict[str, Dict[str, str]] = read_all_lines_etym(lines)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/en-langs.py", line 59, in read_all_lines_etym
    exec(concat, globals())
  File "<string>", line 2588
    for _, lang in pairs(m) do
                            ^^
SyntaxError: invalid syntax
Exception in thread Thread-11 (process_script):
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/__main__.py", line 52, in process_script
    data = subprocess.check_output(["python", f"scripts/{script}"], text=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python', 'scripts/en-langs.py']' returned non-zero exit status 1.

And we should try something more about retries:

Traceback (most recent call last):
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/de-lang_adjs.py", line 15, in <module>
    sub_soup = get_soup(li_url)
               ^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/scripts_utils.py", line 35, in get_soup
    page = get_content(url)
           ^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/scripts_utils.py", line 31, in get_content
    raise RuntimeError(f"Sorry, too many tries [{retry}] for {url!r}")
RuntimeError: Sorry, too many tries [5] for 'https://de.wiktionary.org/wiki/Vorlage:nordd.'
Exception in thread Thread-5 (process_script):
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/__main__.py", line 52, in process_script
    data = subprocess.check_output(["python", f"scripts/{script}"], text=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python', 'scripts/de-lang_adjs.py']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/en-form-of.py", line 53, in <module>
    count += print_aliases(tds["template"], text, tds["dot"] == "yes")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/en-form-of.py", line 18, in print_aliases
    soup = get_soup(url_template)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/scripts_utils.py", line 35, in get_soup
    page = get_content(url)
           ^^^^^^^^^^^^^^^^
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/scripts_utils.py", line 31, in get_content
    raise RuntimeError(f"Sorry, too many tries [{retry}] for {url!r}")
RuntimeError: Sorry, too many tries [5] for 'https://en.wiktionary.org/wiki/Special:WhatLinksHere?target=Template%3Aarchaic form of&namespace=&hidetrans=1&hidelinks=1'
Exception in thread Thread-9 (process_script):
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/runner/work/ebook-reader-dict/ebook-reader-dict/scripts/__main__.py", line 52, in process_script
    data = subprocess.check_output(["python", f"scripts/{script}"], text=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python', 'scripts/en-form-of.py']' returned non-zero exit status 1.

At the end, maybe should we find a way to make the job to fail on any error? I mean, the job should complete, but if any error happened, then change the job status to failure. Or something like that.

lasconic commented 1 year ago

I made a PR for en-langs.py

At the end, maybe should we find a way to make the job to fail on any error? I mean, the job should complete, but if any error happened, then change the job status to failure. Or something like that.

Maybe see : https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f