# Buggy code
def check_driver():
    """Report on the currently running driver"""
    if drivers.is_nvidia():
        driver_info = drivers.get_nvidia_driver_info()
        # pylint: disable=logging-format-interpolation
        logger.info(
            "Using {vendor} drivers {version} for {arch}".format(**driver_info["nvrm"])
        )
        gpus = drivers.get_nvidia_gpu_ids()
        for gpu_id in gpus:
            gpu_info = drivers.get_nvidia_gpu_info(gpu_id)
            logger.info("GPU: %s", gpu_info.get("Model"))
    elif hasattr(LINUX_SYSTEM, "glxinfo"):
        logger.info("Using %s", LINUX_SYSTEM.glxinfo.opengl_vendor)
        if hasattr(LINUX_SYSTEM.glxinfo, "GLX_MESA_query_renderer"):
            logger.info(
                "Running Mesa driver %s on %s",
                LINUX_SYSTEM.glxinfo.GLX_MESA_query_renderer.version,
                LINUX_SYSTEM.glxinfo.GLX_MESA_query_renderer.device,
            )
    else:
        logger.warning(
            "glxinfo is not available on your system, unable to detect driver version"
        )

    for card in drivers.get_gpus():
        # pylint: disable=logging-format-interpolation
        logger.info(
            "GPU: {PCI_ID} {PCI_SUBSYS_ID} using {DRIVER} drivers".format(
                **drivers.get_gpu_info(card)
            )
        )


# Traceback (KeyError)
$ lutris
2019-02-02 21:46:38,710: Running Lutris 0.5.0
2019-02-02 21:46:38,711: glxinfo is not available on your system, unable to detect driver version
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 223, in do_command_line
run_all_checks()
File "/usr/lib/python3/dist-packages/lutris/startup.py", line 106, in run_all_checks
check_driver()
File "/usr/lib/python3/dist-packages/lutris/startup.py", line 63, in check_driver
**drivers.get_gpu_info(card)
KeyError: 'PCI_ID'
2019-02-02 21:46:38,753: Shutting down Lutris

# Fixed code
def check_driver():
    """Report on the currently running driver"""
    if drivers.is_nvidia():
        driver_info = drivers.get_nvidia_driver_info()
        # pylint: disable=logging-format-interpolation
        logger.info(
            "Using {vendor} drivers {version} for {arch}".format(**driver_info["nvrm"])
        )
        gpus = drivers.get_nvidia_gpu_ids()
        for gpu_id in gpus:
            gpu_info = drivers.get_nvidia_gpu_info(gpu_id)
            logger.info("GPU: %s", gpu_info.get("Model"))
    elif hasattr(LINUX_SYSTEM, "glxinfo"):
        logger.info("Using %s", LINUX_SYSTEM.glxinfo.opengl_vendor)
        if hasattr(LINUX_SYSTEM.glxinfo, "GLX_MESA_query_renderer"):
            logger.info(
                "Running Mesa driver %s on %s",
                LINUX_SYSTEM.glxinfo.GLX_MESA_query_renderer.version,
                LINUX_SYSTEM.glxinfo.GLX_MESA_query_renderer.device,
            )
    else:
        logger.warning(
            "glxinfo is not available on your system, unable to detect driver version"
        )

    for card in drivers.get_gpus():
        # pylint: disable=logging-format-interpolation
        try:
            logger.info(
                "GPU: {PCI_ID} {PCI_SUBSYS_ID} using {DRIVER} drivers".format(
                    **drivers.get_gpu_info(card)
                )
            )
        except KeyError:
            logger.error("Unable to get GPU information from '%s'", card)