rosettatype / hyperglot

Hyperglot: a database and tools for detecting language support in fonts
http://hyperglot.rosettatype.com
GNU General Public License v3.0
162 stars 22 forks source link

KeyError: 'script' in language.py #103

Closed chrissimpkins closed 1 year ago

chrissimpkins commented 1 year ago

I began seeing this exception raised on nightly testing with the f-actions/hyperglot GitHub Action on Roboto approximately 8 days ago. Seems to be ~ coincident with the Hyperglot 0.4.2 release:

Successfully installed click-8.1.3 colorlog-6.7.0 fonttools-4.38.0 hyperglot-0.4.2 pyyaml-6.0 unicodedata2-15.0.0
/opt/hostedtoolcache/Python/3.9.15/x64/bin/hyperglot /home/runner/work/hyperglot/hyperglot/tests/fonts/Roboto-Regular.ttf
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.15/x64/bin/hyperglot", line 8, in <module>
    sys.exit(cli())
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/hyperglot/main.py", line 296, in cli
    supported = langs.supported(chars, support, validity,
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/hyperglot/languages.py", line 292, in supported
    lang_sup = l.supported(chars, supportlevel,
  File "/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages/hyperglot/language.py", line 3[59](https://github.com/f-actions/hyperglot/actions/runs/3612015207/jobs/6086855627#step:5:60), in supported
    if ort.script not in support:
  File "/opt/hostedtoolcache/Python/3.9.15/x[64](https://github.com/f-actions/hyperglot/actions/runs/3612015207/jobs/6086855627#step:5:65)/lib/python3.9/site-packages/hyperglot/language.py", line 402, in script
    return self["script"]
KeyError: 'script'
Error: f-actions/hyperglot Action failed during attempt to run hyperglot with error: The process '/opt/hostedtoolcache/Python/3.9.15/x64/bin/hyperglot' failed with exit code 1

Test configuration:

Run f-actions/hyperglot@main
  with:
    path: tests/fonts/Roboto-Regular.ttf
    version: latest
    marks: false
    decomposed: false
    autonyms: false
    users: false
    all-orthographies: false
    include-historical: false
    include-constructed: false
    strict-iso: false
    verbose: false
    args: none
kontur commented 1 year ago

Thanks for reporting, this was indeed due to an issue in the data. Added additional pre-commit checks and fixed in latest 0.4.3 update.

Cool to see Hyperglot in use like that 👍 (cc @MrBrezina check it)

@chrissimpkins Aside from not breaking releases, anything you'd wish Hyperglot would do that it doesn't, re. that action hook?

chrissimpkins commented 1 year ago

anything you'd wish Hyperglot would do that it doesn't, re. that action hook?

Works great for me. No suggestions for the custom GH Action configuration. Thanks for all of the work that you've done to develop it!

chrissimpkins commented 1 year ago

And thanks for the fix!