How to use the pydevd.GetGlobalDebugger function in pydevd

To help you get started, we’ve selected a few pydevd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / ptvsd / src / ptvsd / _vendored / pydevd / tests_python / resources / _debugger_case_remote_2.py View on Github external
if __name__ == '__main__':
    print('Run as main: %s' % (__file__,))
    import sys
    sys.stdout.flush()
    import pydevd
    # Just check that we're already connected
    assert pydevd.GetGlobalDebugger() is not None
    print('finish')
    sys.stdout.flush()
    print('TEST SUCEEDED!')
    sys.stdout.flush()
github fabioz / PyDev.Debugger / tests_python / resources / _debugger_case_remote_2.py View on Github external
if __name__ == '__main__':
    print('Run as main: %s' % (__file__,))
    import sys
    sys.stdout.flush()
    import pydevd
    # Just check that we're already connected
    assert pydevd.GetGlobalDebugger() is not None
    print('finish')
    sys.stdout.flush()
    print('TEST SUCEEDED!')
    sys.stdout.flush()
github fabioz / Pydev / plugins / org.python.pydev.core / pysrc / tests_python / resources / _debugger_case_remote_2.py View on Github external
if __name__ == '__main__':
    print('Run as main: %s' % (__file__,))
    import sys
    sys.stdout.flush()
    import pydevd
    # Just check that we're already connected
    assert pydevd.GetGlobalDebugger() is not None
    print('finish')
    sys.stdout.flush()
    print('TEST SUCEEDED!')
    sys.stdout.flush()
github fabioz / Pydev / plugins / org.python.pydev / pysrc / pydevconsole.py View on Github external
def __init__(self, host, client_port):
        self.client_port = client_port
        self.host = host
        try:
            import pydevd #@UnresolvedImport
            if pydevd.GetGlobalDebugger() is None:
                raise RuntimeError() #Work as if the debugger does not exist as it's not connected.
        except:
            self.namespace = globals()
        else:
            #Adapted from the code in pydevd
            #patch provided by: Scott Schlesier - when script is run, it does not 
            #pretend pydevconsole is not the main module, and
            #convince the file to be debugged that it was loaded as main
            sys.modules['pydevconsole'] = sys.modules['__main__']
            sys.modules['pydevconsole'].__name__ = 'pydevconsole'            
            
            from imp import new_module
            m = new_module('__main__')
            sys.modules['__main__'] = m
            ns = m.__dict__
            try:
github man-group / mdf / mdf / viewer / frame.py View on Github external
# try to import again
        import pydevd
        import pydevd_tracing

    if not _ipython_active():
        # remove any redirection
        if getattr(sys, "_pydev_orig_stdout", None) is None:
            sys._pydev_orig_stdout = sys.stdout
        if getattr(sys, "_pydev_orig_stderr", None) is None:
            sys._pydev_orig_stderr = sys.stderr

        sys.stdout = sys._pydev_orig_stdout
        sys.stderr = sys._pydev_orig_stderr

    # stop any existing debugger
    dbg = pydevd.GetGlobalDebugger()
    if dbg:
        dbg.FinishDebuggingSession()
        time.sleep(0.1)
        pydevd_tracing.SetTrace(None)

        # remove any additional info for the current thread
        try:
            del threading.currentThread().__dict__["additionalInfo"]
        except KeyError:
            pass

        pydevd.SetGlobalDebugger(None)
        pydevd.connected = False
        time.sleep(0.1)

    # do this a couple of times as when re-connecting the first doesn't work
github deis / deis / pydevd / pydevconsole.py View on Github external
def __init__(self, host, client_port):
        self.client_port = client_port
        self.host = host
        try:
            import pydevd #@UnresolvedImport
            if pydevd.GetGlobalDebugger() is None:
                raise RuntimeError() #Work as if the debugger does not exist as it's not connected.
        except:
            self.namespace = globals()
        else:
            #Adapted from the code in pydevd
            #patch provided by: Scott Schlesier - when script is run, it does not 
            #pretend pydevconsole is not the main module, and
            #convince the file to be debugged that it was loaded as main
            sys.modules['pydevconsole'] = sys.modules['__main__']
            sys.modules['pydevconsole'].__name__ = 'pydevconsole'            
            
            from imp import new_module
            m = new_module('__main__')
            sys.modules['__main__'] = m
            ns = m.__dict__
            try:
github circus-tent / circus / circus / _patch.py View on Github external
import threading
from threading import _active_limbo_lock, _active, _sys
from .util import get_python_version


debugger = False
try:
    # noinspection PyUnresolvedReferences
    import pydevd
    debugger = pydevd.GetGlobalDebugger()
except ImportError:
    pass

if not debugger:
    # see http://bugs.python.org/issue1596321
    if hasattr(threading.Thread, '_Thread__delete'):
        def _delete(self):
            try:
                with _active_limbo_lock:
                    del _active[self._Thread__ident]
            except KeyError:
                if 'dummy_threading' not in _sys.modules:
                    raise

        threading.Thread._Thread__delete = _delete
    else: