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


Python pydevd.settrace方法代码示例

本文整理汇总了Python中pydevd.settrace方法的典型用法代码示例。如果您正苦于以下问题:Python pydevd.settrace方法的具体用法?Python pydevd.settrace怎么用?Python pydevd.settrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pydevd的用法示例。


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

示例1: debug

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def debug(func):
    if not DEBUG:
        return func

    def wrapper(*args, **kwargs):
        import pydevd
        pydevd.settrace('localhost', port=4242, stdoutToServer=True, stderrToServer=True)

        try:
            func(*args, **kwargs)
        except Exception as e:
            pydevd.stoptrace()
            raise

        pydevd.stoptrace()

    return wrapper 
开发者ID:Soap4me,项目名称:Kodi,代码行数:19,代码来源:addon.py

示例2: _get_python_c_args

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def _get_python_c_args(host, port, indC, args, setup):
    setup = _get_setup_updated_with_protocol_and_ppid(setup)

    # i.e.: We want to make the repr sorted so that it works in tests.
    setup_repr = setup if setup is None else (sorted_dict_repr(setup))

    return ("import sys; sys.path.insert(0, r'%s'); import pydevd; pydevd.PydevdCustomization.DEFAULT_PROTOCOL=%r; "
            "pydevd.settrace(host=%r, port=%s, suspend=False, trace_only_current_thread=False, patch_multiprocessing=True, access_token=%r, client_access_token=%r, __setup_holder__=%s); "
            "%s"
            ) % (
               pydev_src_dir,
               pydevd_constants.get_protocol(),
               host,
               port,
               setup.get('access-token'),
               setup.get('client-access-token'),
               setup_repr,
               args[indC + 1]) 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:20,代码来源:pydev_monkey.py

示例3: _detect_debug_environment

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def _detect_debug_environment():
    """
    Detect whether server is running in a debug environment
    if so, connect to debug server at a port stored in env[DEBUG_REST_SERVICE]
    """
    try:
        docl_debug_path = os.environ.get('DEBUG_CONFIG')
        if docl_debug_path and os.path.isfile(docl_debug_path):
            with open(docl_debug_path, 'r') as docl_debug_file:
                debug_config = yaml.safe_load(docl_debug_file)
            if debug_config.get('is_debug_on'):
                import pydevd
                pydevd.settrace(
                    debug_config['host'], port=53100, stdoutToServer=True,
                    stderrToServer=True, suspend=False)
    except BaseException as e:
        raise Exception('Failed to connect to debug server, {0}: {1}'.
                        format(type(e).__name__, str(e))) 
开发者ID:cloudify-cosmo,项目名称:cloudify-manager,代码行数:20,代码来源:server.py

示例4: setup_remote_pydev_debug

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def setup_remote_pydev_debug(host, port):
    error_msg = ('Error setting up the debug environment. Verify that the'
                 ' option pydev_worker_debug_host is pointing to a valid '
                 'hostname or IP on which a pydev server is listening on'
                 ' the port indicated by pydev_worker_debug_port.')

    try:
        try:
            from pydev import pydevd
        except ImportError:
            import pydevd

        pydevd.settrace(host,
                        port=port,
                        stdoutToServer=True,
                        stderrToServer=True)
        return True
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(error_msg) 
开发者ID:openstack,项目名称:searchlight,代码行数:22,代码来源:utils.py

示例5: setup_remote_pydev_debug

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def setup_remote_pydev_debug():
    """Required setup for remote debugging."""

    if CONF.pydev_debug_host and CONF.pydev_debug_port:
        try:
            try:
                from pydev import pydevd
            except ImportError:
                import pydevd

            pydevd.settrace(CONF.pydev_debug_host,
                            port=int(CONF.pydev_debug_port),
                            stdoutToServer=True,
                            stderrToServer=True)
        except Exception:
            LOG.exception('Unable to join debugger, please '
                          'make sure that the debugger processes is '
                          'listening on debug-host \'%s\' debug-port \'%s\'.',
                          CONF.pydev_debug_host, CONF.pydev_debug_port)
            raise 
开发者ID:cloud-security-research,项目名称:sgx-kms,代码行数:22,代码来源:config.py

示例6: startdebugger

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def startdebugger():
    debugegg = ''
    if sys.platform.lower().startswith('win'):
        debugegg = os.path.expandvars('%programfiles(x86)%\\JetBrains\\PyCharm 2016.1\\debug-eggs\\pycharm-debug.egg')
    elif sys.platform.lower().startswith('darwin'):
        debugegg = '/Applications/PyCharm.app/Contents/debug-eggs/pycharm-debug.egg'
    elif sys.platform.lower().startswith('linux'):
        debugegg = os.path.expandvars(os.path.expanduser('~/Applications/pycharm-2016.1.4/debug-eggs/pycharm-debug.egg'))
    if os.path.exists(debugegg):
        sys.path.append(debugegg)
        try:
            import pydevd
        except ImportError:
            xbmc.log(msg = 'Debugger import error @: "%s"' % debugegg)
            pydevd = pydevd_dummy
        pydevd.settrace('localhost', port=51234, stdoutToServer=True, stderrToServer=True, suspend=False)
    else:
        xbmc.log(msg='Debugger not found @: "%s"' % debugegg) 
开发者ID:KenV99,项目名称:script.service.kodi.callbacks,代码行数:20,代码来源:debugger.py

示例7: setup_remote_pydev_debug

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def setup_remote_pydev_debug():
    """Required setup for remote debugging."""

    if CONF.pydev_debug_host and CONF.pydev_debug_port:
        try:
            try:
                from pydev import pydevd
            except ImportError:
                import pydevd

            pydevd.settrace(CONF.pydev_debug_host,
                            port=int(CONF.pydev_debug_port),
                            stdoutToServer=True,
                            stderrToServer=True)
        except Exception:
            LOG.exception('Unable to join debugger, please '
                          'make sure that the debugger processes is '
                          'listening on debug-host \'%(debug-host)s\' '
                          'debug-port \'%(debug-port)s\'.',
                          {'debug-host': CONF.pydev_debug_host,
                           'debug-port': CONF.pydev_debug_port})
            raise 
开发者ID:openstack,项目名称:barbican,代码行数:24,代码来源:config.py

示例8: attach

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def attach(port, host):
    try:
        import pydevd
        pydevd.stoptrace() #I.e.: disconnect if already connected
        # pydevd.DebugInfoHolder.DEBUG_RECORD_SOCKET_READS = True
        # pydevd.DebugInfoHolder.DEBUG_TRACE_BREAKPOINTS = 3
        # pydevd.DebugInfoHolder.DEBUG_TRACE_LEVEL = 3
        pydevd.settrace(
            port=port,
            host=host,
            stdoutToServer=True,
            stderrToServer=True,
            overwrite_prev_trace=True,
            suspend=False,
            trace_only_current_thread=False,
            patch_multiprocessing=False,
        )
    except:
        import traceback;traceback.print_exc() 
开发者ID:mrknow,项目名称:filmkodi,代码行数:21,代码来源:attach_script.py

示例9: execute

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def execute(self, context):
        import sys

        user_preferences = context.user_preferences
        addon_prefs = user_preferences.addons[__name__].preferences

        eggpath = os.path.abspath(addon_prefs.eggpath)

        if not os.path.exists(eggpath):
            self.report({'ERROR'}, 'Unable to find debug egg at %r. Configure the addon properties '
                                   'in the User Preferences menu.' % eggpath)
            return {'CANCELLED'}

        if not any('pycharm-debug' in p for p in sys.path):
            sys.path.append(eggpath)

        import pydevd
        pydevd.settrace('localhost', port=1090, stdoutToServer=True, stderrToServer=True)

        return {'FINISHED'} 
开发者ID:pelednoam,项目名称:mmvt,代码行数:22,代码来源:remote_debugger.py

示例10: execute

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def execute(self, context):
        fol = op.join(DataMakerPanel.pycharm_fol, 'debug-eggs')
        eggpath = op.join(fol, 'pydevd-pycharm.egg')
        if not op.exists(eggpath):
            eggpath = op.join(fol, 'pycharm-debug-py3k.egg')
        if not op.exists(eggpath):
            self.report({'ERROR'}, 'Unable to find debug egg at {}. Configure the addon properties '
                                   'in the User Preferences menu.'.format(eggpath))
            return {'CANCELLED'}

        if not any('pycharm-debug' in p for p in sys.path):
            print('Adding eggpath to the path: {}'.format(eggpath))
            sys.path.append(eggpath)

        import pydevd
        print('Waiting to connects to a PyCharm debugger on localhost:1090')
        pydevd.settrace('localhost', port=1090, stdoutToServer=True, stderrToServer=True)
        return {'FINISHED'} 
开发者ID:pelednoam,项目名称:mmvt,代码行数:20,代码来源:data_panel.py

示例11: debug

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def debug(user=None):
    # Turn on debug printing automatically if a debugger is attached
    try:
        import pydevd
        pydevd.settrace()
    except ImportError:
        pass
    return None, httplib.OK 
开发者ID:mitre,项目名称:cascade-server,代码行数:10,代码来源:api.py

示例12: config

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def config(config):
    # prepare mqtt settings
    print('debug feature enabled')
    debughost = config.get('debughost', None)
    debugport = config.get('debugport', None)
    if None not in (debughost,debugport):
        try:
            print('activate debug for '+debughost+' Port '+str(debugport))
            pydevd.settrace(debughost, port=int(debugport), stdoutToServer=True, stderrToServer=True)
        except Exception as e:
            print( '...failed')
            print(e)
            pass 
开发者ID:datenschuft,项目名称:SMA-EM,代码行数:15,代码来源:remotedebug.py

示例13: install_breakpointhook

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def install_breakpointhook():
    def custom_sitecustomize_breakpointhook(*args, **kwargs):
        import os
        hookname = os.getenv('PYTHONBREAKPOINT')
        if (
               hookname is not None 
               and len(hookname) > 0 
               and hasattr(sys, '__breakpointhook__')
               and sys.__breakpointhook__ != custom_sitecustomize_breakpointhook
            ):
            sys.__breakpointhook__(*args, **kwargs)
        else:
            sys.path.append(os.path.dirname(os.path.dirname(__file__)))
            import pydevd
            kwargs.setdefault('stop_at_frame', sys._getframe().f_back)
            pydevd.settrace(*args, **kwargs)

    if sys.version_info[0:2] >= (3, 7):
        # There are some choices on how to provide the breakpoint hook. Namely, we can provide a 
        # PYTHONBREAKPOINT which provides the import path for a method to be executed or we
        # can override sys.breakpointhook.
        # pydevd overrides sys.breakpointhook instead of providing an environment variable because
        # it's possible that the debugger starts the user program but is not available in the 
        # PYTHONPATH (and would thus fail to be imported if PYTHONBREAKPOINT was set to pydevd.settrace).
        # Note that the implementation still takes PYTHONBREAKPOINT in account (so, if it was provided
        # by someone else, it'd still work).
        sys.breakpointhook = custom_sitecustomize_breakpointhook
    else:
        if sys.version_info[0] >= 3:
            import builtins as __builtin__ # Py3
        else:
            import __builtin__

        # In older versions, breakpoint() isn't really available, so, install the hook directly
        # in the builtins.
        __builtin__.breakpoint = custom_sitecustomize_breakpointhook
        sys.__breakpointhook__ = custom_sitecustomize_breakpointhook

# Install the breakpoint hook at import time. 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:41,代码来源:sitecustomize.py

示例14: ask_for_stop

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def ask_for_stop(use_back):
    import pydevd
    if use_back:
        pydevd.settrace(stop_at_frame=sys._getframe().f_back)
    else:
        pydevd.settrace()
    print('Will stop here if use_back==False.') 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:9,代码来源:_debugger_case_settrace.py

示例15: execute

# 需要导入模块: import pydevd [as 别名]
# 或者: from pydevd import settrace [as 别名]
def execute(self, context):
        import pydevd
        pydevd.settrace()
        return {'FINISHED'} 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:6,代码来源:fd_general.py


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