• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python msg.error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中msg.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __check_ise_version

    def __check_ise_version(self):
        import subprocess
        import re
        xst = subprocess.Popen('which xst', shell=True,
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
        lines = xst.stdout.readlines()
        if not lines:
            p.error("Xilinx binaries are not in the PATH variable\n"
                "Can't determine ISE version")
            quit()

        xst = str(lines[0].strip())
        version_pattern = re.compile(".*?(\d\d\.\d).*") #First check if we have version in path
        match = re.match(version_pattern, xst)
        if match:
            ise_version=match.group(1)
        else: #If it is not the case call the "xst -h" to get version
            xst_output = subprocess.Popen('xst -h', shell=True,
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
            xst_output = xst_output.stdout.readlines()[0]
            xst_output = xst_output.strip()
            version_pattern = \
                    re.compile('Release\s(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d)\s.*')
            match = re.match(version_pattern, xst_output)
            if match:
                ise_version=''.join((match.group('major'), '.', match.group('minor')))
            else:
                p.error("xst output is not in expected format: "+ xst_output +"\n"
                        "Can't determine ISE version")
                return None

        p.vprint("ISE version: " + ise_version)
        return ise_version
开发者ID:JamesHyunKim,项目名称:hdl-make2,代码行数:33,代码来源:hdlmake_kernel.py


示例2: on_patch

    def on_patch(self, data):
        buf_id = data['id']
        buf = self.FLOO_BUFS[buf_id]
        view = self.get_view(buf_id)
        DMP = dmp.diff_match_patch()
        if len(data['patch']) == 0:
            msg.error('wtf? no patches to apply. server is being stupid')
            return
        dmp_patches = DMP.patch_fromText(data['patch'])
        # TODO: run this in a separate thread
        if view:
            old_text = view.get_text()
        else:
            old_text = buf.get('buf', '')
        md5_before = hashlib.md5(old_text.encode('utf-8')).hexdigest()
        if md5_before != data['md5_before']:
            msg.debug('maybe vim is lame and discarded a trailing newline')
            old_text += '\n'
        md5_before = hashlib.md5(old_text.encode('utf-8')).hexdigest()
        if md5_before != data['md5_before']:
            msg.warn('starting md5s don\'t match for %s. ours: %s patch: %s this is dangerous!' %
                    (buf['path'], md5_before, data['md5_before']))

        t = DMP.patch_apply(dmp_patches, old_text)

        clean_patch = True
        for applied_patch in t[1]:
            if not applied_patch:
                clean_patch = False
                break

        if G.DEBUG:
            if len(t[0]) == 0:
                msg.debug('OMG EMPTY!')
                msg.debug('Starting data:', buf['buf'])
                msg.debug('Patch:', data['patch'])
            if '\x01' in t[0]:
                msg.debug('FOUND CRAZY BYTE IN BUFFER')
                msg.debug('Starting data:', buf['buf'])
                msg.debug('Patch:', data['patch'])

        if not clean_patch:
            msg.error('failed to patch %s cleanly. re-fetching buffer' % buf['path'])
            return self.agent.send_get_buf(buf_id)

        cur_hash = hashlib.md5(t[0].encode('utf-8')).hexdigest()
        if cur_hash != data['md5_after']:
            msg.warn(
                '%s new hash %s != expected %s. re-fetching buffer...' %
                (buf['path'], cur_hash, data['md5_after'])
            )
            return self.agent.send_get_buf(buf_id)

        buf['buf'] = t[0]
        buf['md5'] = cur_hash

        if not view:
            self.save_buf(buf)
            return
        view.apply_patches(buf, t)
开发者ID:awesome,项目名称:floobits-vim,代码行数:60,代码来源:protocol.py


示例3: mkdir

def mkdir(path):
    try:
        os.makedirs(path)
    except OSError as e:
        if e.errno != 17:
            msg.error('Can not create directory {0}.\n{1}'.format(path, e))
            raise
开发者ID:awesome,项目名称:floobits-vim,代码行数:7,代码来源:utils.py


示例4: update_data

def update_data(data, keys, skip=None):

    """Remove not requested datasets.

    Keyword arguments:
    data -- dicionary with data
    keys -- user-requested keys
    skip -- the key not to delete
    """

    for key in data.keys():
        if key == skip:
            continue
        if key not in keys:
            del data[key]

    if not len(data):
        msg.error("No datasets to process.")
        sys.exit(1)

    check.get_size(data)

    for key in keys:
        if key not in data.keys():
            msg.warning("%s requested, but not found." % key)
开发者ID:TomaszGolan,项目名称:hdf5_manipulator,代码行数:25,代码来源:extract.py


示例5: connect

 def connect(self):
     self.empty_selects = 0
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     if self.secure:
         if ssl:
             cert_path = os.path.join(G.COLAB_DIR, 'startssl-ca.pem')
             with open(cert_path, 'wb') as cert_fd:
                 cert_fd.write(cert.CA_CERT.encode('utf-8'))
             self.sock = ssl.wrap_socket(self.sock, ca_certs=cert_path, cert_reqs=ssl.CERT_REQUIRED)
         else:
             msg.log('No SSL module found. Connection will not be encrypted.')
             if self.port == G.DEFAULT_PORT:
                 self.port = 3148  # plaintext port
     msg.log('Connecting to %s:%s' % (self.host, self.port))
     try:
         self.sock.settimeout(30)  # Seconds before timing out connecting
         self.sock.connect((self.host, self.port))
         if self.secure and ssl:
             self.sock.do_handshake()
     except socket.error as e:
         msg.error('Error connecting:', e)
         self.reconnect()
         return
     self.sock.setblocking(False)
     msg.log('Connected!')
     self.reconnect_delay = G.INITIAL_RECONNECT_DELAY
     utils.set_timeout(self.select, 0)
     self.auth()
开发者ID:ToM-Korn,项目名称:sublime-text-2-plugin,代码行数:28,代码来源:agent_connection.py


示例6: update_view

 def update_view(buf, view=None):
     view = view or get_view(buf['id'])
     visible_region = view.visible_region()
     viewport_position = view.viewport_position()
     region = sublime.Region(0, view.size())
     # deep copy
     selections = [x for x in view.sel()]
     MODIFIED_EVENTS.put(1)
     try:
         edit = view.begin_edit()
         view.replace(edit, region, buf['buf'])
     except Exception as e:
         msg.error('Exception updating view: %s' % e)
     finally:
         view.end_edit(edit)
     sublime.set_timeout(lambda: view.set_viewport_position(viewport_position, False), 0)
     view.sel().clear()
     view.show(visible_region, False)
     for sel in selections:
         view.sel().add(sel)
     if 'patch' in G.PERMS:
         view.set_read_only(False)
     else:
         view.set_status('Floobits', 'You don\'t have write permission. Buffer is read-only.')
         view.set_read_only(True)
开发者ID:nilbus,项目名称:sublime-text-2-plugin,代码行数:25,代码来源:listener.py


示例7: add_file

 def add_file(self, p):
     p_path = os.path.join(self.path, p)
     if p[0] == '.' and p not in HIDDEN_WHITELIST:
         msg.log('Ignoring hidden path %s' % p_path)
         return
     is_ignored = self.is_ignored(p_path)
     if is_ignored:
         msg.log(is_ignored)
         return
     try:
         s = os.stat(p_path)
     except Exception as e:
         msg.error('Error lstat()ing path %s: %s' % (p_path, unicode(e)))
         return
     if stat.S_ISDIR(s.st_mode):
         ig = Ignore(self, p_path)
         self.children.append(ig)
         self.size += ig.size
         return
     elif stat.S_ISREG(s.st_mode):
         if s.st_size > (MAX_FILE_SIZE):
             self.ignores['/TOO_BIG/'].append(p)
             msg.log(self.is_ignored_message(p_path, p, '/TOO_BIG/'))
         else:
             self.size += s.st_size
             self.files.append(p)
开发者ID:bobfirestone,项目名称:Bobs-.emacs.d,代码行数:26,代码来源:ignore.py


示例8: connect

 def connect(self, cb=None):
     self.empty_selects = 0
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     if self.secure:
         if ssl:  # ST2 on linux doesn't have the ssl module. Not sure about windows
             self.sock = ssl.wrap_socket(self.sock, ca_certs=CERT, cert_reqs=ssl.CERT_REQUIRED)
         else:
             msg.debug("No SSL module found. Connection will not be encrypted.")
             if self.port == G.DEFAULT_PORT:
                 self.port = 3148  # plaintext port
     msg.debug("Connecting to %s:%s" % (self.host, self.port))
     try:
         self.sock.connect((self.host, self.port))
         if self.secure and ssl:
             self.sock.do_handshake()
     except socket.error as e:
         msg.error("Error connecting:", e)
         self.reconnect()
         return
     self.sock.setblocking(0)
     msg.debug("Connected!")
     self.reconnect_delay = G.INITIAL_RECONNECT_DELAY
     self.send_auth()
     if cb:
         cb()
开发者ID:nkabir,项目名称:floobits-vim,代码行数:25,代码来源:agent_connection.py


示例9: is_ignored

 def is_ignored(self, path, is_dir=None):
     rel_path = os.path.relpath(path, self.path)
     for ignore_file, patterns in self.ignores.items():
         for pattern in patterns:
             base_path, file_name = os.path.split(rel_path)
             if pattern[0] == '/':
                 # Only match immediate children
                 if utils.unfuck_path(base_path) == self.path and fnmatch.fnmatch(file_name, pattern[1:]):
                     return self.is_ignored_message(path, pattern, ignore_file)
             else:
                 if len(pattern) > 0 and pattern[-1] == '/':
                     if is_dir is None:
                         try:
                             s = os.stat(path)
                         except Exception as e:
                             msg.error('Error lstat()ing path %s: %s' % (path, unicode(e)))
                             continue
                         is_dir = stat.S_ISDIR(s.st_mode)
                     if is_dir:
                         pattern = pattern[:-1]
                 if fnmatch.fnmatch(file_name, pattern):
                     return self.is_ignored_message(path, pattern, ignore_file)
                 if fnmatch.fnmatch(rel_path, pattern):
                     return self.is_ignored_message(path, pattern, ignore_file)
     if self.parent:
         return self.parent.is_ignored(path)
     return False
开发者ID:Web5design,项目名称:plugin-common-python,代码行数:27,代码来源:ignore.py


示例10: __init__

    def __init__(self, parent, path):
        self.parent = parent
        self.size = 0
        self.children = []
        self.files = []
        self.ignores = {
            '/TOO_BIG/': []
        }
        self.path = utils.unfuck_path(path)

        try:
            paths = os.listdir(self.path)
        except OSError as e:
            if e.errno != errno.ENOTDIR:
                raise
            self.path = os.path.dirname(self.path)
            self.add_file(os.path.basename(path))
            return
        except Exception as e:
            msg.error('Error listing path %s: %s' % (path, unicode(e)))
            return

        msg.log('Initializing ignores for %s' % path)
        for ignore_file in IGNORE_FILES:
            try:
                self.load(ignore_file)
            except:
                pass

        for p in paths:
            self.add_file(p)
开发者ID:bobfirestone,项目名称:Bobs-.emacs.d,代码行数:31,代码来源:ignore.py


示例11: make_list_of_modules

    def make_list_of_modules(self):
        p.vprint("Making list of modules for " + str(self))
        new_modules = [self]
        modules = [self]
        while len(new_modules) > 0:
            cur_module = new_modules.pop()

            if not cur_module.isfetched:
                p.error("Unfetched module in modules list: " + str(cur_module))
                quit()
            if cur_module.manifest == None:
                p.vprint("No manifest in " + str(cur_module))
                continue
            cur_module.parse_manifest()

            for module in cur_module.local:
                modules.append(module)
                new_modules.append(module)

            for module in cur_module.git:
                modules.append(module)
                new_modules.append(module)

            for module in cur_module.svn:
                modules.append(module)
                new_modules.append(module)

        if len(modules) == 0:
            p.vprint("No modules were found in " + self.fetchto)
        return modules
开发者ID:JamesHyunKim,项目名称:hdl-make2,代码行数:30,代码来源:module.py


示例12: get_info

def get_info(workspace_url, project_dir):
    repo_type = detect_type(project_dir)
    if not repo_type:
        return
    msg.debug('Detected ', repo_type, ' repo in ', project_dir)
    data = {
        'type': repo_type,
    }
    cmd = REPO_MAPPING[repo_type]['cmd']
    try:
        p = subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             cwd=project_dir)
        result = p.communicate()
        repo_url = result[0].decode('utf-8').strip()
        if repo_type == 'svn':
            repo_url = parse_svn_xml(repo_url)
        msg.log(repo_type, ' url is ', repo_url)
        if not repo_url:
            msg.error('Error getting ', repo_type, ' url:', result[1])
            return
    except Exception as e:
        msg.error('Error getting ', repo_type, ' url:', str_e(e))
        return

    data['url'] = repo_url
    return data
开发者ID:Floobits,项目名称:floobits-emacs,代码行数:28,代码来源:repo.py


示例13: delete_buf

    def delete_buf(self, path):
        """deletes a path"""

        if not path:
            return

        path = utils.get_full_path(path)

        if not self.is_shared(path):
            msg.error("Skipping deleting %s because it is not in shared path %s." % (path, G.PROJECT_PATH))
            return

        if os.path.isdir(path):
            for dirpath, dirnames, filenames in os.walk(path):
                # Don't care about hidden stuff
                dirnames[:] = [d for d in dirnames if d[0] != "."]
                for f in filenames:
                    f_path = os.path.join(dirpath, f)
                    if f[0] == ".":
                        msg.log("Not deleting buf for hidden file %s" % f_path)
                    else:
                        self.delete_buf(f_path)
            return
        buf_to_delete = None
        rel_path = utils.to_rel_path(path)
        for buf_id, buf in self.FLOO_BUFS.items():
            if rel_path == buf["path"]:
                buf_to_delete = buf
                break
        if buf_to_delete is None:
            msg.error("%s is not in this room" % path)
            return
        msg.log("deleting buffer ", rel_path)
        event = {"name": "delete_buf", "id": buf_to_delete["id"]}
        self.agent.put(event)
开发者ID:rdgmatos,项目名称:dot,代码行数:35,代码来源:protocol.py


示例14: delete_buf

 def delete_buf(path):
     if not utils.is_shared(path):
         msg.error('Skipping deleting %s because it is not in shared path %s.' % (path, G.PROJECT_PATH))
         return
     if os.path.isdir(path):
         for dirpath, dirnames, filenames in os.walk(path):
             # TODO: rexamine this assumption
             # Don't care about hidden stuff
             dirnames[:] = [d for d in dirnames if d[0] != '.']
             for f in filenames:
                 f_path = os.path.join(dirpath, f)
                 if f[0] == '.':
                     msg.log('Not deleting buf for hidden file %s' % f_path)
                 else:
                     Listener.delete_buf(f_path)
         return
     buf_to_delete = None
     rel_path = utils.to_rel_path(path)
     for buf_id, buf in BUFS.items():
         if rel_path == buf['path']:
             buf_to_delete = buf
             break
     if buf_to_delete is None:
         msg.error('%s is not in this room' % path)
         return
     msg.log('deleting buffer ', rel_path)
     event = {
         'name': 'delete_buf',
         'id': buf_to_delete['id'],
     }
     Listener.agent.put(event)
开发者ID:rosshadden,项目名称:floobits-sublime,代码行数:31,代码来源:listener.py


示例15: generate_filelist

def generate_filelist(prefix, old_size, new_size):

    """Generate filenames for output files
    and return as a dict (file: [begin, end]).

    Keyword arguments:
    prefix -- common path/to/basename
    old_size -- size of input hdf5 files
    new_size -- requested size for output hdf5 files
    """

    if new_size >= old_size:
        msg.error("Use splitter wisely...")
        sys.exit(1)

    nof_files, leftover = old_size / new_size, old_size % new_size

    files = OrderedDict()

    for i in range(nof_files + int(leftover > 0)):
        filename = "%(prefix)s_%(id)03d.hdf5" % {"prefix": prefix, "id": i}
        begin = i * new_size
        end = (i + 1) * new_size if i < nof_files else i * new_size + leftover
        files[filename] = [begin, end]

    return files
开发者ID:gnperdue,项目名称:hdf5_manipulator,代码行数:26,代码来源:split.py


示例16: create

 def create(self):
     """
     create() prototype
     :return: boolean
     """
     msg.error("Service " + str(self.__module__) + "doesn't implement create() function?")
     return False
开发者ID:chen--oRanGe,项目名称:netdata,代码行数:7,代码来源:base.py


示例17: run_local_synthesis

 def run_local_synthesis(self):
     tm = self.modules_pool.get_top_module()
     if tm.target == "xilinx":
         if not os.path.exists("run.tcl"):
             self.__generate_tcl()
         os.system("xtclsh run.tcl")
     else:
         p.error("Target " + tm.target + " is not synthesizable")
开发者ID:JamesHyunKim,项目名称:hdl-make2,代码行数:8,代码来源:hdlmake_kernel.py


示例18: update

 def update(self, interval):
     """
     update() prototype
     :param interval: int
     :return: boolean
     """
     msg.error("Service " + str(self.__module__) + "doesn't implement update() function")
     return False
开发者ID:chen--oRanGe,项目名称:netdata,代码行数:8,代码来源:base.py


示例19: set_text

 def set_text(self, text):
     msg.debug("\n\nabout to patch %s %s" % (str(self), self.vim_buf.name))
     try:
         msg.debug("now buf is loadedish? %s" % vim.eval("bufloaded(%s)" % self.native_id))
         self.vim_buf[:] = text.encode("utf-8").split("\n")
     except Exception as e:
         msg.error("couldn't apply patches because: %s!\nThe unencoded text was: %s" % (str(e), text))
         raise
开发者ID:rdgmatos,项目名称:dot,代码行数:8,代码来源:vim_protocol.py


示例20: load_settings

def load_settings():
    settings = load_floorc()
    if not settings:
        msg.error('you should probably define some stuff in your ~/.floorc file')
    G.COLAB_DIR = os.path.expanduser(settings.get('share_dir', '~/.floobits/share/'))
    mkdir(G.COLAB_DIR)
    for name, val in settings.items():
        setattr(G, name, val)
开发者ID:awesome,项目名称:floobits-vim,代码行数:8,代码来源:utils.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python msg.info函数代码示例发布时间:2022-05-27
下一篇:
Python msg.debug函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap