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

Python error.traceback函数代码示例

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

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



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

示例1: OnBlogWindow

def OnBlogWindow(win, event):
    try:
        win.mainframe.createBlogWindow()
        win.panel.showPage('Blog')
    except:
        error.traceback()
        common.showerror(win, tr('There is something wrong as running Blog Edit'))
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:7,代码来源:__init__.py


示例2: copy_mo

 def copy_mo(self):
     langpath = os.path.join(self.mainframe.workpath, 'lang')
     dirs = [d for d in os.listdir(langpath) if os.path.isdir(os.path.join(langpath, d))]
     files = glob.glob(os.path.join(self.mainframe.workpath, 'plugins/*/*.mo'))
     import shutil
     for f in files:
         fname = os.path.splitext(os.path.basename(f))[0]
         flag = False
         for lang in dirs:
             if fname.endswith(lang):
                 flag = True
                 break
         if not flag:
             lang = fname[-5:]
             try:
                 os.makedirs(os.path.join(self.mainframe.workpath, 'lang', fname[-5:]))
             except Exception, e:
                 error.traceback()
                 common.showerror(self, str(e))
                 continue
         dst = os.path.join(self.mainframe.workpath, 'lang', lang, os.path.basename(f))
         try:
             shutil.copyfile(f, dst)
         except Exception, e:
             error.traceback()
             common.showerror(self, str(e))
             continue
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:27,代码来源:PluginDialog.py


示例3: set_modules_time

 def set_modules_time(self, mod):
     try:
         sfile = mod.__file__
         if os.path.exists(sfile):
             self.acpmodules_time[mod] = os.path.getmtime(sfile)
     except:
         error.traceback()
开发者ID:barry963,项目名称:Robot_project,代码行数:7,代码来源:InputAssistant.py


示例4: connect

        def connect(self):
            self.running = True

            site = self.pref.sites_info[self.pref.ftp_sites[self.cmbSite.GetSelection()]]
            self.ftp = FTP()

            #connect
            try:
                common.setmessage(self.mainframe, tr('Connecting to %s (%s:%s)...') % (site['name'],site['ip'], site['port']))
                self.ftp.connect(site['ip'], site['port'])
                flag, user, password = self.getuserpassword(self.cmbSite.GetSelection(), self.txtUser.GetValue(), self.txtPassword.GetValue())
                if not flag:
                    common.setmessage(self.mainframe, tr('Connection canceled'))
                    self.ftp = None
                    self.alive = False
                    self.running = False
                    return
                common.setmessage(self.mainframe, tr('Logging in...'))
                self.ftp.login(user, password)
            except socket.error, msg:
                error.traceback()
                common.showerror(self, msg[1])
                self.ftp = None
                self.running = False
                return
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:25,代码来源:FtpClass.py


示例5: OnDocumentVoiceConfig

def OnDocumentVoiceConfig(win, event):
    if not win.pytts:
        try:
            import pyTTS
            win.pytts = pyTTS.Create()
            win.pytts_flag = pyTTS.tts_is_xml, pyTTS.tts_async
            win.pytts.OnEndStream = win.OnTTSEndStream
        except:
            error.traceback()
            common.showerror(win, tr("Can't import pyTTS module, please install it first."))
            return
    voices = win.pytts.GetVoiceNames()
    if not voices:
        common.showerror(win, tr("There is no available voices installed"))
        return
    if not win.pref.voice_name:
        win.pref.voice_name = voices[0]
    dialog = [
            ('single', 'voice_name', win.pref.voice_name, tr('Voice names:'), zip(voices, voices)),
            ('int', 'tts_rate', win.pref.tts_rate, tr('TTS speak rate:'), None)
        ]
    from modules.EasyGuider import EasyDialog
    dlg = EasyDialog.EasyDialog(win, title=tr("Text to Speech setting"), elements=dialog)
    values = None
    if dlg.ShowModal() == wx.ID_OK:
        values = dlg.GetValue()
    dlg.Destroy()
    win.pref.tts_rate = values['tts_rate']
    win.pref.voice_name = values['voice_name']
    win.pref.save()
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:30,代码来源:__init__.py


示例6: get_function

 def get_function(self, modstring):
     func = None
     if not isinstance(modstring, list) and modstring.startswith('@'):
         module, function = modstring[1:].rsplit('.', 1)
         if self.acpmodules.has_key(module):
             mod = self.acpmodules[module]
             if self.need_reinstall_module(mod):
                 mod = reload(mod)
                 self.set_modules_time(mod)
         else:
             try:
                 mod = __import__(module, [], [], [''])
                 self.set_modules_time(mod)
             except:
                 error.error("Can't load the module " + module)
                 error.traceback()
                 return False
             self.acpmodules[module] = mod
         func = getattr(mod, function, None)
         if not callable(func):
             func = None
         else:
             func.module_name = module
             func.function_name = function
     return func
开发者ID:barry963,项目名称:Robot_project,代码行数:25,代码来源:InputAssistant.py


示例7: readfile

def readfile(mainframe, filename, siteno, user=None, password=None):
    if siteno >= len(mainframe.pref.ftp_sites):
        common.showerror(mainframe, tr("Can't find the FTP site."))
        return

    site = mainframe.pref.sites_info[mainframe.pref.ftp_sites[siteno]]
    if not user:
        user = site['user']
    if not password:
        password = site['password']

    flag, user, password = getuserpassword(mainframe, siteno)
    if not flag:
        common.setmessage(mainframe, tr('Connection canceled'))
        return

    ftp = FTP()
    try:
        ftp.connect(site['ip'], site['port'])
        ftp.login(user, password)
        ftp.set_pasv(site['pasv'])
        data = []
        def getdata(d, data=data):
            data.append(d)
        ftp.retrbinary("RETR %s" % common.decode_string(filename), getdata)
        ftp.quit()
        ftp.close()
        text = ''.join(data)
        return text
    except Exception, msg:
        error.traceback()
        common.showerror(mainframe, msg)
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:32,代码来源:FtpClass.py


示例8: writefile

def writefile(mainframe, filename, siteno, text, user=None, password=None):
    if siteno >= len(mainframe.pref.ftp_sites):
        common.showerror(mainframe, tr("Can't find the FTP site."))
        return

    site = mainframe.pref.sites_info[mainframe.pref.ftp_sites[siteno]]
    if not user:
        user = site['user']
    if not password:
        password = site['password']

    flag, user, password = getuserpassword(mainframe, siteno)
    if not flag:
        common.setmessage(mainframe, tr('Connection canceled'))
        return

    ftp = FTP()
    #connect
    try:
        ftp.connect(site['ip'], site['port'])
        ftp.login(user, password)
        ftp.set_pasv(site['pasv'])
        import StringIO
        f = StringIO.StringIO(text)
        ftp.storbinary("STOR %s" % common.decode_string(filename), f)
        ftp.quit()
        ftp.close()
        return True
    except Exception, msg:
        error.traceback()
        common.showerror(mainframe, msg)
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:31,代码来源:FtpClass.py


示例9: delete

 def delete(self):
     index = self.list.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
     if index >= 0:
         flag = self.list.GetItemData(index)
         if flag == 2:
             return
         pathname = self.list.GetItemText(index)
         dlg = wx.MessageDialog(self, tr("Do you want to delete %s?") % pathname, tr("Delete"), wx.YES_NO | wx.ICON_QUESTION)
         answer = dlg.ShowModal()
         if answer == wx.ID_YES:
             if flag == 0:   #dir
                 try:
                     self.ftp.rmd(common.decode_string(pathname))
                 except Exception, msg:
                     error.traceback()
                     common.showerror(self, msg)
                     return
             elif flag == 1: #file
                 try:
                     self.ftp.delete(common.decode_string(pathname))
                 except Exception, msg:
                     error.traceback()
                     common.showerror(self, msg)
                     return
             self.refresh(self.curpath)
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:25,代码来源:FtpClass.py


示例10: OnDjangoFunc

def OnDjangoFunc(win, event):
    _id = event.GetId()
    try:
        if hasattr(win, "IDPM_DJANGO_STARTAPP") and _id == win.IDPM_DJANGO_STARTAPP:
            OnDjangoStartApp(win)
        elif hasattr(win, "IDPM_DJANGO_INSTALLAPP") and _id == win.IDPM_DJANGO_INSTALLAPP:
            d = Casing.Casing(OnDjangoInstallApp, win)
            v = Casing.new_obj()
            v.count = 0
            #            d.onprocess(onprocess, v=v, timestep=0.1)
            #            d.onsuccess(onsuccess)
            #            d.onexception(onsuccess)
            d.start_thread()
        elif hasattr(win, "IDPM_DJANGO_INSTALLSYSAPP_ADMIN") and _id == win.IDPM_DJANGO_INSTALLSYSAPP_ADMIN:
            d = Casing.Casing(OnDjangoInstallConApp, win, "admin")
            v = Casing.new_obj()
            #            d.onprocess(onprocess, v=v, timestep=0.1)
            #            d.onsuccess(onsuccess)
            #            d.onexception(onsuccess)
            d.start_thread()
        elif hasattr(win, "IDPM_DJANGO_RUNSERVER") and _id == win.IDPM_DJANGO_RUNSERVER:
            OnDjangoRunServer(win)
        elif hasattr(win, "IDPM_DJANGO_RUNSHELL") and _id == win.IDPM_DJANGO_RUNSHELL:
            OnDjangoRunShell(win)
        elif hasattr(win, "IDPM_DJANGO_DOT") and _id == win.IDPM_DJANGO_DOT:
            OnCreateDot(win)
    except:
        error.traceback()
        common.showerror(win, tr("There is some wrong as executing the menu."))
开发者ID:hfpiao,项目名称:ulipad,代码行数:29,代码来源:dirbrowser_ext.py


示例11: OnDelete

 def OnDelete(self, event):
     item = self.tree.GetSelection()
     if not self.is_ok(item): return
     parent = self.tree.GetItemParent(item)
     filename = self.get_node_filename(item)
     dlg = wx.MessageDialog(self, tr('Do you want to delete %s ?') % filename, tr("Message"), wx.YES_NO | wx.ICON_INFORMATION)
     if dlg.ShowModal() == wx.ID_YES:
         if os.path.exists(filename):
             if os.path.isdir(filename):
                 try:
                     shutil.rmtree(filename)
                 except:
                     error.traceback()
                     common.showerror(self, tr('Cannot delete directory %s!') % filename)
                     return
             else:
                 try:
                     os.remove(filename)
                 except:
                     error.traceback()
                     common.showerror(self, tr('Cannot delete file %s!') % filename)
                     return
         self.tree.Delete(item)
     if self.tree.GetChildrenCount(parent) == 0:
         self.tree.Collapse(parent)
         self.tree.SetItemImage(parent, self.close_image, wx.TreeItemIcon_Normal)
     dlg.Destroy()
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:27,代码来源:DirBrowser.py


示例12: install_acp

    def install_acp(self, editor, language, changeflag=False):
#        changeflag = False
        filename = common.getConfigPathFile('%s.acp' % language)
        if not os.path.exists(filename):
            if assistant.has_key(language):
                del assistant[language]
                changeflag = True
        else:
            if not changeflag:
                changeflag = self.install_assistant(language, filename)
        self.editor = editor

        try:
            self.lasteditor
        except:
            error.traceback()
            self.lasteditor = None
            self.lastlanguage = None

        if changeflag or not self.lasteditor is editor or self.lastlanguage != editor.languagename:
            self.lasteditor = editor
            self.lastlanguage = editor.languagename
            #re cal all the default auto indentifier list
            editor.default_auto_identifier = {}
            editor.input_calltip = []
            editor.input_autodot = []
            editor.input_locals = []
            editor.input_analysis = []
            for obj in self.get_acp(language) + editor.custom_assistant:
                self.install_default_auto_identifier(obj)
                self.install_calltip(obj)
                self.install_autodot(obj)
                self.install_locals(obj)
                self.install_analysis(obj)
        return True
开发者ID:barry963,项目名称:Robot_project,代码行数:35,代码来源:InputAssistant.py


示例13: delete

    def delete(self, postid=''):
        if not postid:
            index = self.list.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
            if index == -1:
                common.showmessage(self.mainframe, tr('You should select on entry first!'))
                return
            filename = self.data[index]
            tree = Tree()
            tree.read_from_xml(file(filename).read())
            data = tree['entry']

            postid = data['postid']

        common.setmessage(self.mainframe, tr('Deleting entry...'))
        site = self.pref.blog_sites_info[self.pref.blog_sites[self.cmbSite.GetSelection()]]
        try:
            server = xmlrpclib.ServerProxy(site['url'])
            result = server.blogger.deletePost('', postid, site['user'], site['password'], False)
            if result:
                common.showmessage(self.mainframe, tr('Delete is successful!'))
                self.list.DeleteItem(index)
            else:
                common.showerror(self.mainframe, tr('Delete error!'))

        except Exception, msg:
            error.traceback()
            common.showerror(self.mainframe, msg)
开发者ID:LaoMa3953,项目名称:ulipad,代码行数:27,代码来源:BlogManageWindow.py


示例14: read_snippet_file

 def read_snippet_file(self, filename, type, expand):
     try:
         e = ElementTree(file=filename)
         
         def f():
             
             title = e.find('snippet/properties/title')
             nodes = e.find('snippet/content')
             data = {'type':'root', 'filename':filename, 'element':nodes, 
                 'etree':e, 'caption':title.text}
             node = self.add_new_folder(self.root, title.text, data, modified=False)
             
             def add_nodes(root, nodes):
                 for n in nodes:
                     if n.tag == 'node':
                         obj = self.add_new_node(root, n.attrib['caption'], data={'element':n}, modified=False)
                     elif n.tag == 'folder':
                         obj = self.add_new_folder(root, n.attrib['caption'], data={'element':n}, modified=False)
                         add_nodes(obj, n.getchildren())
                 if expand:
                     self.tree.Expand(root)
                         
             add_nodes(node, nodes)
             wx.CallAfter(self.tree.SelectItem, node)
             if type == 'new':
                 wx.CallAfter(self.tree.EditLabel, node)
                 
             self._save_files()
         
         wx.CallAfter(f)
     except:
         error.traceback()
         common.showerror(tr("There are some errors as openning the Snippet file"))
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:33,代码来源:CodeSnippet.py


示例15: OnStart

    def OnStart(self, event=None):
        if not self.status:
            if not self.me or self.me == '*':
                common.showerror(self, tr("Username should not be empty or '*'"))
                self.txtName.SetFocus()
                return

            ip = self.txtIP.GetValue()
            if not ip:
                common.showerror(self, tr("Host address cannot be empty!"))
                self.txtIP.SetFocus()
                return
            port = int(self.txtPort.GetValue())
            self.pref.pairprog_host = ip
            self.pref.pairprog_port = port
            self.pref.pairprog_username = self.me
            self.pref.save()
            try:
                self.server = Server.start_server(ip, port, self.servercommands)
                if self.server:
                    self.AddUser(self.me, manager=True)
                    self.change_status('startserver')
                    self.callplugin('start', self, 'server')
            except:
                common.warn(tr("Start server error!"))
                error.traceback()
        else:
            self.server.shut_down()
            self.server = None
            self.change_status('stopserver')
            self.callplugin('stop', self, 'server')
开发者ID:LaoMa3953,项目名称:ulipad,代码行数:31,代码来源:Concurrent.py


示例16: newfile

    def newfile(self):
        filename = ''
        dlg = MyTextEntry(self, tr("Filename Input"), tr('Input a new filename:'), '')
        answer = dlg.ShowModal()
        if answer == wx.ID_OK:
            filename = dlg.GetValue()
            if not filename:
                return
            #check if the new name has existed
            index = self.list.FindItem(-1, filename)
            if index > -1:
                common.showerror(self, tr('The filename already exists.\nPlease input another one.'))
                return
            from StringIO import StringIO
            f = StringIO('')
            try:
                self.ftp.storbinary('STOR %s' % common.decode_string(filename), f)
            except Exception, msg:
                error.traceback()
                common.showerror(self, msg)
                return

            if self.refresh(self.curpath):
                index = self.list.FindItem(-1, filename)
                self.list.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_MASK_STATE)
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:25,代码来源:FtpClass.py


示例17: OnSearchJumpDef

def OnSearchJumpDef(win, event):
    global _mlist
    
    word = getword(win)
    from modules import ctags
    
    flag = False
    prjfile = common.getProjectFile(win.document.getFilename())
    if prjfile:
        path = os.path.dirname(prjfile)
        ini = dict4ini.DictIni(prjfile)
        s = []
        for c in ini.ctags.values():
            c = os.path.join(path, c)
            p = os.path.dirname(c)
            try:
                s.extend(ctags.get_def(c, word, p))
            except:
                error.traceback()
        if len(s) == 1:
            d, f, m = s[0]
            win.editctrl.new(f)
            flag = jump_to_file(win, d, f, m)
        elif len(s) > 1:
            text = []
            _mlist = {}
            for i, v in enumerate(s):
                d, f, m = v
                key = str(i+1)+'|'+d+'|'+os.path.basename(f)
                text.append(key)
                _mlist[key] = (d, f, m)
            win.document.UserListShow(2, " ".join(text))
            flag = True
    if not flag:
        win.document.callplugin('on_jump_definition', win.document, word)
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:35,代码来源:mCTags.py


示例18: project_end

def project_end(dirwin, project_names, path):
    if 'python' in project_names:
        try:
            if path in sys.path:
                sys.path.remove(path)
        except:
            error.traceback()
开发者ID:LinYuanLab,项目名称:ulipad,代码行数:7,代码来源:mPythonProject.py


示例19: install_default_auto_identifier

 def install_default_auto_identifier(self, obj):
     if not obj.ini.has_key('auto_default'):
         return
     r = obj.ini.auto_default.values()
     if not r:
         return
     slist = []
     for i in r:
         func = self.get_function(i)
         if func:
             try:
                 result = func(self.editor)
                 if result:
                     slist.extend(result)
             except:
                 error.error('Execute %s.%s failed!' % (func.module_name, func.function_name))
                 error.traceback()
                 return False
         else:
             if not isinstance(i, list):
                 slist.append(i)
             else:
                 slist.extend(i)
     d = self.editor.default_auto_identifier
     for i in slist:
         if len(i) <= 1:
             continue
         k = i[0].upper()
         s = d.setdefault(k, [])
         if i not in s:
             s.append(i)
     for k, v in d.items():
         d[k].sort(lambda x, y:cmp(x.upper(), y.upper()))
开发者ID:barry963,项目名称:Robot_project,代码行数:33,代码来源:InputAssistant.py


示例20: install_keylist

    def install_keylist(self, items, re_flag=False):
        d = {}
        for key, value in items:
            for k, v in KEYS.items():
                key = key.replace(k, v)
            b = self.r_key.search(key)
            if b:
                key = b.groups()[0]
                last_key = convert_key(b.groups()[1])
            else:
                last_key = (0, ord(key[-1]))
#                key = key[:-1]
            if re_flag:
                try:
                    r = re.compile(key)
                except:
                    error.info("key=%s, value=%s" % (key,value))
                    error.traceback()
                    continue
            else:
                r = key
            if d.has_key(last_key):
                d[last_key].append((r, self.gettext(value)))
            else:
                d[last_key] =[(r, self.gettext(value))]
        return d
开发者ID:barry963,项目名称:Robot_project,代码行数:26,代码来源:InputAssistant.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python Progress.updateProgress函数代码示例发布时间:2022-05-27
下一篇:
Python Convert.ConvertType类代码示例发布时间: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