# Buggy code
def _getAvailableAddonsFromPath(path):
    """Gets available add-ons from path.
    An addon is only considered available if the manifest file is loaded with no errors.
    @param path: path from where to find addon directories.
    @type path: string
    @rtype generator of Addon instances
    """
    log.debug("Listing add-ons from %s", path)
    for p in os.listdir(path):
        if p.endswith(DELETEDIR_SUFFIX):
            continue
        addon_path = os.path.join(path, p)
        if os.path.isdir(addon_path) and addon_path not in (".", ".."):
            log.debug("Loading add-on from %s", addon_path)
            try:
                a = Addon(addon_path)
                name = a.manifest["name"]
                log.debug(
                    "Found add-on {name} - {a.version}."
                    " Requires API: {a.minimumNVDAVersion}."
                    " Last-tested API: {a.lastTestedNVDAVersion}".format(name=name, a=a)
                )
                if a.isDisabled:
                    log.debug("Disabling add-on %s", name)
                if not isAddonCompatible(a):
                    log.debugWarning("Add-on %s is considered incompatible", name)
                    _blockedAddons.add(a.name)
                yield a
            except:
                log.error(
                    "Error loading Addon from path: %s", addon_path, exc_info=True
                )


# Traceback (IOError)
INFO - __main__ (13:35:20.844):
Starting NVDA
INFO - core.main (13:35:21.078):
Config dir: C:\Users\Username\AppData\Roaming\nvda
INFO - config.ConfigManager._loadConfig (13:35:21.078):
Loading config: C:\Users\Username\AppData\Roaming\nvda\nvda.ini
INFO - core.main (13:35:21.128):
NVDA version next-14528,b476430a
INFO - core.main (13:35:21.128):
Using Windows version 10.0.15063 workstation
INFO - core.main (13:35:21.128):
Using Python version 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]
INFO - core.main (13:35:21.128):
Using comtypes version 0.6.2
CRITICAL - __main__ (13:35:21.134):
core failure
Traceback (most recent call last):
File "nvda.pyw", line 202, in <module>
File "core.pyc", line 202, in main
File "addonHandler.pyc", line 124, in initialize
File "addonHandler.pyc", line 74, in completePendingAddonRemoves
File "addonHandler.pyc", line 215, in __init__
IOError: [Errno 2] No such file or directory: u'C:\\Users\\Username\\AppData\\Roaming\\nvda\\addons\\ocr\\manifest.ini'

# Fixed code
def _getAvailableAddonsFromPath(path):
    """Gets available add-ons from path.
    An addon is only considered available if the manifest file is loaded with no errors.
    @param path: path from where to find addon directories.
    @type path: string
    @rtype generator of Addon instances
    """
    log.debug("Listing add-ons from %s", path)
    for p in os.listdir(path):
        if p.endswith(DELETEDIR_SUFFIX):
            continue
        addon_path = os.path.join(path, p)
        if os.path.isdir(addon_path) and addon_path not in (".", ".."):
            if not len(os.listdir(addon_path)):
                log.error("Error loading Addon from path: %s", addon_path)
            else:
                log.debug("Loading add-on from %s", addon_path)
                try:
                    a = Addon(addon_path)
                    name = a.manifest["name"]
                    log.debug(
                        "Found add-on {name} - {a.version}."
                        " Requires API: {a.minimumNVDAVersion}."
                        " Last-tested API: {a.lastTestedNVDAVersion}".format(
                            name=name, a=a
                        )
                    )
                    if a.isDisabled:
                        log.debug("Disabling add-on %s", name)
                    if not isAddonCompatible(a):
                        log.debugWarning("Add-on %s is considered incompatible", name)
                        _blockedAddons.add(a.name)
                    yield a
                except:
                    log.error(
                        "Error loading Addon from path: %s", addon_path, exc_info=True
                    )