# Buggy code
def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):
    super(PorcupineHotWord, self).__init__(key_phrase, config, lang)
    porcupine_path = expanduser(
        self.config.get("porcupine_path", join("~", ".mycroft", "Porcupine"))
    )
    keyword_file_paths = [
        expanduser(x.strip())
        for x in self.config.get("keyword_file_path", "hey_mycroft.ppn").split(",")
    ]
    sensitivities = self.config.get("sensitivities", 0.5)
    bindings_path = join(porcupine_path, "binding/python")
    LOG.info("Adding %s to Python path" % bindings_path)
    sys.path.append(bindings_path)
    try:
        from porcupine import Porcupine
    except ImportError:
        raise Exception(
            "Python bindings for Porcupine not found. "
            "Please use --porcupine-path to set Porcupine base path"
        )

    system = platform.system()
    machine = platform.machine()
    library_path = join(porcupine_path, "lib/linux/%s/libpv_porcupine.so" % machine)
    model_file_path = join(porcupine_path, "lib/common/porcupine_params.pv")
    if isinstance(sensitivities, float):
        sensitivities = [sensitivities] * len(keyword_file_paths)
    else:
        sensitivities = [float(x) for x in sensitivities.split(",")]

    self.audio_buffer = []
    self.has_found = False
    self.num_keywords = len(keyword_file_paths)
    LOG.info(
        "Loading Porcupine using library path {} and keyword paths {}".format(
            library_path, keyword_file_paths
        )
    )
    self.porcupine = Porcupine(
        library_path=library_path,
        model_file_path=model_file_path,
        keyword_file_paths=keyword_file_paths,
        sensitivities=sensitivities,
    )

    LOG.info("Loaded Porcupine")


# Traceback (TypeError)
2020-10-13 18:03:22.296 | INFO     |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:328 | Creating wake word engine
2020-10-13 18:03:22.299 | INFO     |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:351 | Using hotword entry for blueberry
2020-10-13 18:03:22.302 | WARNING  |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:353 | Phonemes are missing falling back to listeners configuration
2020-10-13 18:03:22.305 | WARNING  |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:357 | Threshold is missing falling back to listeners configuration
2020-10-13 18:03:22.310 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "blueberry" wake word via porcupine
2020-10-13 18:03:22.315 | INFO     |  6577 | mycroft.client.speech.hotword_factory:__init__:331 | Adding /home/pi/.mycroft/Porcupine/binding/python to Python path
2020-10-13 18:03:22.338 | INFO     |  6577 | mycroft.client.speech.hotword_factory:__init__:356 | Loading Porcupine using library path /home/pi/.mycroft/Porcupine/lib/linux/armv7l/libpv_porcupine.so and keyword paths ['/home/pi/.mycroft/Porcupine/resources/keyword_files/raspberry-pi/blueberry_raspberry-pi.ppn']
2020-10-13 18:03:22.341 | ERROR    |  6577 | mycroft.client.speech.hotword_factory:initialize:423 | Could not create hotword. Falling back to default.
Traceback (most recent call last):
File "/home/pi/mycroft-core/mycroft/client/speech/hotword_factory.py", line 411, in initialize
instance = clazz(hotword, config, lang=lang)
File "/home/pi/mycroft-core/mycroft/client/speech/hotword_factory.py", line 361, in __init__
sensitivities=sensitivities)
TypeError: __init__() got an unexpected keyword argument 'model_file_path'
2020-10-13 18:03:22.345 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "blueberry" wake word via pocketsphinx
2020-10-13 18:03:22.475 | INFO     |  6577 | mycroft.client.speech.listener:create_wakeup_recognizer:365 | creating stand up word engine
2020-10-13 18:03:22.478 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "wake up" wake word via pocketsphinx
2020-10-13 18:03:22.602 | INFO     |  6577 | __main__:on_ready:175 | Speech client is ready.

# Fixed code
def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):
    super().__init__(key_phrase, config, lang)
    keyword_file_paths = [
        expanduser(x.strip())
        for x in self.config.get("keyword_file_path", "hey_mycroft.ppn").split(",")
    ]
    sensitivities = self.config.get("sensitivities", 0.5)

    try:
        from pvporcupine.porcupine import Porcupine
        from pvporcupine.util import pv_library_path, pv_model_path
    except ImportError as err:
        raise Exception(
            "Python bindings for Porcupine not found. "
            'Please run "mycroft-pip install pvporcupine"'
        ) from err

    library_path = pv_library_path("")
    model_file_path = pv_model_path("")
    if isinstance(sensitivities, float):
        sensitivities = [sensitivities] * len(keyword_file_paths)
    else:
        sensitivities = [float(x) for x in sensitivities.split(",")]

    self.audio_buffer = []
    self.has_found = False
    self.num_keywords = len(keyword_file_paths)

    LOG.warning(
        "The Porcupine wakeword engine shipped with "
        "Mycroft-core is deprecated and will be removed in "
        "mycroft-core 21.02. Use the mycroft-porcupine-plugin "
        "instead."
    )
    LOG.info(
        "Loading Porcupine using library path {} and keyword paths {}".format(
            library_path, keyword_file_paths
        )
    )
    self.porcupine = Porcupine(
        library_path=library_path,
        model_path=model_file_path,
        keyword_paths=keyword_file_paths,
        sensitivities=sensitivities,
    )

    LOG.info("Loaded Porcupine")