Exemple #1
0
def startPyDevD(ide,
                host='127.0.0.1',
                port=5678,
                suspend=False,
                traceOnlyCurrentThread=False):
    global bwPyDevDStarted
    if not bwPyDevDStarted:
        bwPyDevDStarted = True
        pydevDir = ResMgr.resolveToAbsolutePath(
            'scripts/common/pydev/%s/pydev' % ide)
        if not os.path.isdir(pydevDir):
            bwdebug.ERROR_MSG(
                'Failed to start pydevd: Unable to find pydevd directory for IDE %s'
                % ide)
        sys.path.append(pydevDir)
        try:
            import pydevd
            bwdebug.INFO_MSG('PyDevD connecting to %s:%d' % (host, port))
            pydevd.settrace(host=host,
                            port=port,
                            suspend=suspend,
                            stdoutToServer=True,
                            stderrToServer=True,
                            trace_only_current_thread=traceOnlyCurrentThread)
            threading.currentThread().__pydevd_id__ = BigWorld.component
        except Exception as e:
            from traceback import print_exc
            print_exc()
            bwdebug.ERROR_MSG('Failed to load pydevd: %s' % repr(e))
Exemple #2
0
def stopPyDevD():
    global bwPyDevDStarted
    if bwPyDevDStarted:
        bwPyDevDStarted = False
        try:
            import pydevd
            pydevd.stoptrace()
            del threading.currentThread().__pydevd_id__
            bwdebug.INFO_MSG('PyDevD debug has stopped')
        except Exception as e:
            from traceback import print_exc
            print_exc()
            bwdebug.ERROR_MSG('Failed to stop pydevd: %s' % repr(e))