# Buggy code
def _find_rcc_or_raise() -> str:
    """Locate the Qt rcc binary to generate resource files

    1. we always want to use pyrcc5 if it's available, regardless of API
    2. it will sometimes, (if not always) be named pyrcc5.bat on windows...
       but shutil.which() will find that too
    3. We also want to prefer binaries higher up on the path, and we add
       sys.executable to the front of the path (and \\Scripts on windows)
    4. after pyrcc5 we try pyside2-rcc

    see https://github.com/napari/napari/issues/1221
    and https://github.com/napari/napari/issues/1254

    Returns
    -------
    path : str
        Path to the located rcc binary, or None if not found

    Raises
    ------
    FileNotFoundError
        If no executable can be found.
    """
    python_dir = os.path.dirname(sys.executable)
    paths = [python_dir, os.environ.get("PATH", "")]
    if os.name == "nt":
        paths.insert(0, os.path.join(python_dir, "Scripts"))
    path = os.pathsep.join(paths)

    for bin_name in ("pyrcc5", "pyside2-rcc"):
        rcc_binary = shutil.which(bin_name, path=path)
        if rcc_binary:
            yield rcc_binary
    raise FileNotFoundError(
        "Unable to find an executable to build Qt resources (icons).\n"
        "Tried: 'pyrcc5.bat', 'pyrcc5', 'pyside2-rcc'.\n"
        "Please open issue at https://github.com/napari/napari/issues/."
    )


# Traceback (RuntimeError)
C:\Users\rober>C:\Users\rober\AppData\Local\Programs\napari\python\python.exe -m napari
** On entry to DGEBAL parameter number  3 had an illegal value
** On entry to DGEHRD  parameter number  2 had an illegal value
** On entry to DORGHR DORGQR parameter number  2 had an illegal value
** On entry to DHSEQR parameter number  4 had an illegal value
** On entry to DGEBAL parameter number  3 had an illegal value
** On entry to DGEHRD  parameter number  2 had an illegal value
** On entry to DORGHR DORGQR parameter number  2 had an illegal value
** On entry to DHSEQR parameter number  4 had an illegal value
Traceback (most recent call last):
File "runpy.py", line 185, in _run_module_as_main
File "runpy.py", line 144, in _get_module_details
File "runpy.py", line 111, in _get_module_details
File "C:\Users\rober\AppData\Local\Programs\napari\\app\napari\__init__.py", line 48, in <module>
from vispy import app
File "C:\Users\rober\AppData\Local\Programs\napari\\app_packages\vispy\__init__.py", line 30, in <module>
from .util import config, set_log_level, keys, sys_info  # noqa
File "C:\Users\rober\AppData\Local\Programs\napari\\app_packages\vispy\util\__init__.py", line 9, in <module>
from .logs import logger, set_log_level, use_log_level  # noqa
File "C:\Users\rober\AppData\Local\Programs\napari\\app_packages\vispy\util\logs.py", line 14, in <module>
import numpy as np
File "C:\Users\rober\AppData\Local\Programs\napari\\app_packages\numpy\__init__.py", line 305, in <module>
_win_os_check()
File "C:\Users\rober\AppData\Local\Programs\napari\\app_packages\numpy\__init__.py", line 302, in _win_os_check
raise RuntimeError(msg.format(__file__)) from None
RuntimeError: The current Numpy installation ('C:\\Users\\rober\\AppData\\Local\\Programs\\napari\\\\app_packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86

# Fixed code
def _find_rcc_or_raise() -> str:
    """Locate the Qt rcc binary to generate resource files

    1. we always want to use pyrcc5 if it's available, regardless of API
    2. it will sometimes, (if not always) be named pyrcc5.bat on windows...
       but shutil.which() will find that too
    3. We also want to prefer binaries higher up on the path, and we add
       sys.executable to the front of the path (and \\Scripts on windows)
    4. after pyrcc5 we try pyside2-rcc

    see https://github.com/napari/napari/issues/1221
    and https://github.com/napari/napari/issues/1254

    Returns
    -------
    path : str
        Path to the located rcc binary, or None if not found

    Raises
    ------
    FileNotFoundError
        If no executable can be found.
    """
    python_dir = os.path.dirname(sys.executable)
    paths = [python_dir, os.environ.get("PATH", "")]
    if os.name == "nt":
        paths.insert(0, os.path.join(python_dir, "Scripts"))
    # inject bundle binary path if it exists
    bundle_bin = bundle_bin_dir()
    if bundle_bin:
        paths.insert(0, bundle_bin)
    path = os.pathsep.join(paths)

    for bin_name in ("pyrcc5", "pyside2-rcc"):
        rcc_binary = shutil.which(bin_name, path=path)
        if rcc_binary:
            yield rcc_binary
    raise FileNotFoundError(
        "Unable to find an executable to build Qt resources (icons).\n"
        "Tried: 'pyrcc5.bat', 'pyrcc5', 'pyside2-rcc'.\n"
        "Please open issue at https://github.com/napari/napari/issues/."
    )