caksoylar / keymap-drawer

Visualize keymaps that use advanced features like hold-taps and combos, with automatic parsing
https://caksoylar.github.io/keymap-drawer
MIT License
730 stars 62 forks source link

Tabler icons are not loaded anymore #78

Closed thebino closed 8 months ago

thebino commented 8 months ago

The loading of Tabler icons is failing with an not-found

 Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 143, in _fetch_svg_url
    with urlopen(url) as f:
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 557, in error
    result = self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 749, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/.local/bin/keymap", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/__main__.py", line 178, in main
    draw(args, config.draw_config)
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/__main__.py", line 42, in draw
    drawer = KeymapDrawer(
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/draw.py", line 25, in __init__
    self.init_glyphs()
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 58, in init_glyphs
    self.name_to_svg |= self._fetch_glyphs(rest)
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 81, in _fetch_glyphs
    return dict(zip(names, p.map(fetch_fn, names, urls, timeout=FETCH_TIMEOUT)))
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 623, in result_iterator
    yield _result_or_cancel(fs.pop(), end_time - time.monotonic())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 151, in _fetch_svg_url
    raise ValueError(f'Could not fetch SVG from URL "{url}"') from exc
ValueError: Could not fetch SVG from URL "https://unpkg.com/@tabler/icons/icons/screenshot.svg"
ERROR: parsing or drawing failed for corne!
thebino commented 8 months ago

I tried today with the v0.14.0 and still see the issue. Did I miss the URL somewhere maybe? https://github.com/thebino/zmk-config/actions/runs/8409574894/job/23027028090

caksoylar commented 8 months ago

Might be related to #81, I will test later today.

caksoylar commented 8 months ago

I published 0.14.1 with the fix in #82, can you try again?

thebino commented 7 months ago

Hmm. no still the old url in the logs 🤔

caksoylar commented 7 months ago

It seems to be working fine here, how are you testing? Maybe you have a config file that has the old value in it?

e.g. here it is in the web app that has 0.14.1 deployed: https://caksoylar.github.io/keymap-drawer?keymap_yaml=H4sIAAAAAAAC_0WLuw7CMAxF936Fh4ztANmyQT8DVZGbug_JxFIeVAjx76QV0OFKvsfnDgFX68SPy2TglSNZFodsHbqZDIzIkd4V41NyMhWAhDSLPTpAkDUa0PvthPPd77UoFOKmDDRi5q_dwE2phD1TMI_NJqVq-KM-LNOcPMXYDLL67Xdqu9_yfKnhfC05kC5IF6Tb7gNO9xadywAAAA%3D%3D

thebino commented 7 months ago

I don't know why but in the logs always the old url is showing up. I've just changed a single key: https://github.com/thebino/zmk-config/pull/7

See the full build logs build.log

caksoylar commented 7 months ago

You can see here that your config file contains the old value: https://github.com/thebino/zmk-config/blob/9436835e7e4472ac840945ec427856d57fb12bc6/config_black/corne.yaml#L197

It would be good practice to remove any keys that you aren't intending to override from the config files. I am aware that the recommendation in the README is to dump-config and then edit, maybe that should be changed to prevent this kind of issue.

thebino commented 7 months ago

Thanks, I'm feeling stupid that I haven't found this. But now everything is working again