main.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:PyConversations 作者: HeaTTheatR 项目源码 文件源码
def main():
    app = None

    try:
        from libs.loadplugin import load_plugin  # ???????? ????????
        from program import Program  # ???????? ????? ?????????

        # ?????? ??????????.
        app = Program()
        load_plugin(app)
        app.run()
    except Exception:
        text_error = traceback.format_exc()
        open('{}/error.log'.format(directory), 'w').write(text_error)
        print(text_error)

        if app:  # ??????? ????? ?????????? ?? ???? ????????
            try:
                app.screen.clear_widgets()
            except AttributeError:
                pass

        class Error(App):
            '''??????? ????? ? ??????? ??????.'''

            def callback_report(self, *args):
                '''??????? ???????? ???-???????'''

                try:
                    txt = six.moves.urllib.parse.quote(
                        self.win_report.txt_traceback.text.encode('utf-8'))
                    url = 'https://github.com/HeaTTheatR/Conversations' \
                          '/issues/new?body=' + txt
                    webbrowser.open(url)
                except Exception:
                    sys.exit(1)

            def build(self):
                self.win_report = BugReporter(
                    callback_report=self.callback_report,
                    txt_report=text_error,
                    icon_background='data/images/logo.png'
                )

                return self.win_report

        Error().run()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号