Sublime Forum

Detecting whether bracket highlight is installed no longer works

#1

I have used this mechanism for years to detect that bracket highlight is installed:

def bracket_highlighter_installed():
    global is_bracket_highlighter_installed
    if is_bracket_highlighter_installed is None:
        try:
            import BracketHighlighter.bh_core as bh_core
        except ImportError as e:
            is_bracket_highlighter_installed = False
        else:
            is_bracket_highlighter_installed = True
    print("Installed", is_bracket_highlighter_installed)
    print("Path", sys.path)

    return is_bracket_highlighter_installed

It no longer works. It prints an error

No module named 'BracketHighlighter'

I can run “import BracketHighlighter” in the python console window and it works just fine.

Has something changed?

0 Likes

#2

BracketHighlighter runs on python 3.8 on ST4.

You descriptions indicate your checker plugin runs on python 3.3 still and thus can’t see BH anymore.

0 Likes

#3

Is there something I need to do to run my plugin on 3.8?

0 Likes

#4

To opt-in to python 3.8 packages need to contain a .python-version file at root-level with 3.8 content.

1 Like

#5

Worked. Much obliged!

0 Likes