当前位置: 首页>>代码示例>>Python>>正文


Python LOG.error方法代码示例

本文整理汇总了Python中mycroft.util.log.LOG.error方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.error方法的具体用法?Python LOG.error怎么用?Python LOG.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mycroft.util.log.LOG的用法示例。


在下文中一共展示了LOG.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _poll_skill_settings

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def _poll_skill_settings(self):
        """ If identifier exists for this skill poll to backend to
            request settings and store it if it changes
            TODO: implement as websocket

            Args:
                hashed_meta (int): the hashed identifier
        """
        try:
            if not self._complete_intialization:
                self.initialize_remote_settings()
                if not self._complete_intialization:
                    return  # unable to do remote sync
            else:
                original = hash(str(self))
                self.update_remote()
                # Call callback for updated settings
                if self.changed_callback and hash(str(self)) != original:
                    self.changed_callback()

        except Exception as e:
            LOG.error(e)
            LOG.exception("")

        # this is used in core so do not delete!
        if self.is_alive:
            # continues to poll settings every 60 seconds
            t = Timer(60, self._poll_skill_settings)
            t.daemon = True
            t.start()
开发者ID:Ceda-EI,项目名称:mycroft-core,代码行数:32,代码来源:settings.py

示例2: handle_converse_request

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def handle_converse_request(self, message):
        """ Check if the targeted skill id can handle conversation

        If supported, the conversation is invoked.
        """

        skill_id = int(message.data["skill_id"])
        utterances = message.data["utterances"]
        lang = message.data["lang"]

        # loop trough skills list and call converse for skill with skill_id
        for skill in self.loaded_skills:
            if self.loaded_skills[skill]["id"] == skill_id:
                try:
                    instance = self.loaded_skills[skill]["instance"]
                except BaseException:
                    LOG.error("converse requested but skill not loaded")
                    self.ws.emit(Message("skill.converse.response", {
                        "skill_id": 0, "result": False}))
                    return
                try:
                    result = instance.converse(utterances, lang)
                    self.ws.emit(Message("skill.converse.response", {
                        "skill_id": skill_id, "result": result}))
                    return
                except BaseException:
                    LOG.error(
                        "Converse method malformed for skill " + str(skill_id))
        self.ws.emit(Message("skill.converse.response",
                             {"skill_id": 0, "result": False}))
开发者ID:antlarr,项目名称:mycroft-core,代码行数:32,代码来源:main.py

示例3: __init__

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def __init__(self):
        super(GoVivaceSTT, self).__init__()
        self.default_uri = "https://services.govivace.com:49149/telephony"

        if not self.lang.startswith("en") and not self.lang.startswith("es"):
            LOG.error("GoVivace STT only supports english and spanish")
            raise NotImplementedError
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:9,代码来源:__init__.py

示例4: send

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
 def send(self, *args, **kwargs):
     """ Send to all registered GUIs. """
     for gui in self.GUIs.values():
         if gui.socket:
             gui.socket.send(*args, **kwargs)
         else:
             LOG.error('GUI connection {} has no socket!'.format(gui))
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:9,代码来源:base.py

示例5: shutdown

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def shutdown(self):
        for s in self.service:
            try:
                LOG.info('shutting down ' + s.name)
                s.shutdown()
            except Exception as e:
                LOG.error('shutdown of ' + s.name + ' failed: ' + repr(e))

        # remove listeners
        self.bus.remove('mycroft.audio.service.play', self._play)
        self.bus.remove('mycroft.audio.service.queue', self._queue)
        self.bus.remove('mycroft.audio.service.pause', self._pause)
        self.bus.remove('mycroft.audio.service.resume', self._resume)
        self.bus.remove('mycroft.audio.service.stop', self._stop)
        self.bus.remove('mycroft.audio.service.next', self._next)
        self.bus.remove('mycroft.audio.service.prev', self._prev)
        self.bus.remove('mycroft.audio.service.track_info', self._track_info)
        self.bus.remove('mycroft.audio.service.seek_forward',
                        self._seek_forward)
        self.bus.remove('mycroft.audio.service.seek_backward',
                        self._seek_backward)
        self.bus.remove('recognizer_loop:audio_output_start',
                        self._lower_volume)
        self.bus.remove('recognizer_loop:record_begin', self._lower_volume)
        self.bus.remove('recognizer_loop:audio_output_end',
                        self._restore_volume)
        self.bus.remove('recognizer_loop:record_end', self._restore_volume)
        self.bus.remove('mycroft.stop', self._stop)
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:30,代码来源:audioservice.py

示例6: mute_and_speak

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
def mute_and_speak(utterance, ident):
    """
        Mute mic and start speaking the utterance using selected tts backend.

        Args:
            utterance:  The sentence to be spoken
            ident:      Ident tying the utterance to the source query
    """
    global tts_hash

    # update TTS object if configuration has changed
    if tts_hash != hash(str(config.get('tts', ''))):
        global tts
        # Stop tts playback thread
        tts.playback.stop()
        tts.playback.join()
        # Create new tts instance
        tts = TTSFactory.create()
        tts.init(bus)
        tts_hash = hash(str(config.get('tts', '')))

    LOG.info("Speak: " + utterance)
    try:
        tts.execute(utterance, ident)
    except RemoteTTSTimeoutException as e:
        LOG.error(e)
        mimic_fallback_tts(utterance, ident)
    except Exception as e:
        LOG.error('TTS execution failed ({})'.format(repr(e)))
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:31,代码来源:speech.py

示例7: _read_data

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
def _read_data():
    """ Writes the dictionary of state data from the IPC directory.
    Returns:
        dict: loaded state information
    """
    managerIPCDir = os.path.join(get_ipc_directory(), "managers")

    path = os.path.join(managerIPCDir, "disp_info")
    permission = "r" if os.path.isfile(path) else "w+"

    if permission == "w+" and os.path.isdir(managerIPCDir) is False:
        os.makedirs(managerIPCDir)

    data = {}
    try:
        with open(path, permission) as dispFile:

            if os.stat(str(dispFile.name)).st_size != 0:
                data = json.load(dispFile)

    except Exception as e:
        LOG.error(e)
        os.remove(path)
        _read_data()

    return data
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:28,代码来源:display_manager.py

示例8: _read_data

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
def _read_data():
    """ Reads the file in (/tmp/mycroft/ipc/managers/disp_info)
        and returns the the data as python dict
    """
    managerIPCDir = os.path.join(get_ipc_directory(), "managers")

    path = os.path.join(managerIPCDir, "disp_info")
    permission = "r" if os.path.isfile(path) else "w+"

    if permission == "w+" and os.path.isdir(managerIPCDir) is False:
        os.makedirs(managerIPCDir)

    data = {}
    try:
        with open(path, permission) as dispFile:

            if os.stat(str(dispFile.name)).st_size != 0:
                data = json.load(dispFile)

    except Exception as e:
        LOG.error(e)
        os.remove(path)
        _read_data()

    return data
开发者ID:aatchison,项目名称:mycroft-core,代码行数:27,代码来源:display_manager.py

示例9: __init__

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def __init__(self, cache=None):
        super(RemoteConf, self).__init__(None)

        cache = cache or '/opt/mycroft/web_config_cache.json'

        try:
            # Here to avoid cyclic import
            from mycroft.api import DeviceApi
            api = DeviceApi()
            setting = api.get_settings()
            location = api.get_location()
            if location:
                setting["location"] = location
            # Remove server specific entries
            config = {}
            translate_remote(config, setting)
            for key in config:
                self.__setitem__(key, config[key])
            self.store(cache)

        except HTTPError as e:
            LOG.error("HTTPError fetching remote configuration: %s" %
                      e.response.status_code)
            self.load_local(cache)

        except Exception as e:
            LOG.error("Failed to fetch remote configuration: %s" % repr(e),
                      exc_info=True)
            self.load_local(cache)
开发者ID:Ceda-EI,项目名称:mycroft-core,代码行数:31,代码来源:config.py

示例10: __init__

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
    def __init__(self, emitter):
        FallbackSkill.__init__(self)
        self.config = ConfigurationManager.get()['padatious']
        intent_cache = expanduser(self.config['intent_cache'])

        try:
            from padatious import IntentContainer
        except ImportError:
            LOG.error('Padatious not installed. Please re-run dev_setup.sh')
            try:
                call(['notify-send', 'Padatious not installed',
                      'Please run build_host_setup and dev_setup again'])
            except OSError:
                pass
            return
        ver = get_distribution('padatious').version
        if ver != PADATIOUS_VERSION:
            LOG.warning('Using Padatious v' + ver + '. Please re-run ' +
                        'dev_setup.sh to install ' + PADATIOUS_VERSION)

        self.container = IntentContainer(intent_cache)

        self.emitter = emitter
        self.emitter.on('padatious:register_intent', self.register_intent)
        self.emitter.on('padatious:register_entity', self.register_entity)
        self.register_fallback(self.handle_fallback, 5)
        self.finished_training_event = Event()

        self.train_delay = self.config['train_delay']
        self.train_time = get_time() + self.train_delay
        self.wait_and_train()
开发者ID:aatchison,项目名称:mycroft-core,代码行数:33,代码来源:padatious_service.py

示例11: play_audio_file

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
def play_audio_file(uri: str):
    """ Play an audio file.

    This wraps the other play_* functions, choosing the correct one based on
    the file extension. The function will return directly and play the file
    in the background.

    Arguments:
        uri:    uri to play

    Returns: subprocess.Popen object. None if the format is not supported or
             an error occurs playing the file.

    """
    extension_to_function = {
        '.wav': play_wav,
        '.mp3': play_mp3,
        '.ogg': play_ogg
    }
    _, extension = splitext(uri)
    play_function = extension_to_function.get(extension.lower())
    if play_function:
        return play_function(uri)
    else:
        LOG.error("Could not find a function capable of playing {uri}."
                  " Supported formats are {keys}."
                  .format(uri=uri, keys=list(extension_to_function.keys())))
        return None
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:30,代码来源:__init__.py

示例12: read

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
 def read(self):
     while self.alive:
         try:
             data = self.serial.readline()[:-2]
             if data:
                 self.process(data)
         except Exception as e:
             LOG.error("Reading error: {0}".format(e))
开发者ID:Ceda-EI,项目名称:mycroft-core,代码行数:10,代码来源:__init__.py

示例13: deactivate_skill

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
 def deactivate_skill(self, message):
     """ Deactivate a skill. """
     try:
         skill = message.data['skill']
         if skill in [basename(s) for s in self.loaded_skills]:
             self.__deactivate_skill(skill)
     except Exception as e:
         LOG.error('Couldn\'t deactivate skill, {}'.format(repr(e)))
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:10,代码来源:skill_manager.py

示例14: flush

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
 def flush(self):
     while self.alive:
         try:
             cmd = self.commands.get()
             self.serial.write(cmd + '\n')
             self.commands.task_done()
         except Exception as e:
             LOG.error("Writing error: {0}".format(e))
开发者ID:Ceda-EI,项目名称:mycroft-core,代码行数:10,代码来源:__init__.py

示例15: __play

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import error [as 别名]
 def __play(self, req):
     resp = req.result()
     if resp.status_code == 200:
         self.__save(resp.content)
         play_wav(self.filename).communicate()
     else:
         LOG.error(
             '%s Http Error: %s for url: %s' %
             (resp.status_code, resp.reason, resp.url))
开发者ID:aatchison,项目名称:mycroft-core,代码行数:11,代码来源:remote_tts.py


注:本文中的mycroft.util.log.LOG.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。