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


Python error.traceback函数代码示例

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


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


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