Skip to content

Extension fails to launch with IndexError: tuple index out of range #1

@eloyrobillard

Description

@eloyrobillard

Problem description

Please describe the issue concisely in here. In case of an error: Walk us through the steps you took to get there. What happened? What did you expect to happen?

Extension fails to start when launching Anki.

This is linked to a PR on the original extension: glutanimate/syntax-highlighting#42

To add some context: checking pygments' Available Lexers we can see that lexers like JsonBareObjectLexer do not have a "Short names" field (called aliases in the code).

Because of this we get the error shown below.

Checklist

Please replace the space inside the brackets with an x if the following items apply:

  • I've restarted Anki to see if it helps
  • I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
  • I've verified that I use the latest version of Anki by checking at https://apps.ankiweb.net#download
  • I've tried to disable other add-ons to see if there are any interactions present
  • My issue disappears when I hold shift while starting Anki.
  • I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

Information about your Anki set-up

Anki 23.12.1

Error message (if any)

Anki 23.12.1 (1a1d4d54)  (ao)
Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: macOS-14.0-arm64-arm-64bit

When loading Syntax Highlighting NG:
Traceback (most recent call last):
  File "aqt.addons", line 245, in loadAddons
  File "/Users/eloy/Library/Application Support/Anki2/addons21/566351439/__init__.py", line 24, in <module>
    from . import main  # noqa: F401
  File "/Users/eloy/Library/Application Support/Anki2/addons21/566351439/main.py", line 52, in <module>
    LANGUAGES_MAP = {lex[0]: lex[1][0] for lex in get_all_lexers()}
  File "/Users/eloy/Library/Application Support/Anki2/addons21/566351439/main.py", line 52, in <dictcomp>
    LANGUAGES_MAP = {lex[0]: lex[1][0] for lex in get_all_lexers()}
IndexError: tuple index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions