Local variables not accessible by python debugger

I am trying to figure out what is calling my application for SEGFAULT and managed to track it down to a specific module. I set the trace within a specific module function:

def algorithm_wrapper(*args, **kwargs):        
    _version = version
    if "Version" in kwargs:
        _version = kwargs["Version"]
        del kwargs["Version"]
    algm = _framework.createAlgorithm(algorithm, _version)
    pdb.set_trace()
    _set_logging_option(algm, kwargs)

If I want to check the local variables _version and algm , I get the following error:

-> _set_logging_option(algm, kwargs)
(Pdb) _version
    NameError: name '_version' is not defined
(Pdb) algm
    NameError: name 'algm' is not defined

I am at a loss, this is the first time I find this error. Please, help!

+4
source share
1 answer

I am not an expert in pdb, and it may just be a typo in your code example, and not what you actually tried, but you do not need to enter the following in pdb to print the variable?

(Pdb) p _version

(Pdb) _version

, , , , . !

0

Source: https://habr.com/ru/post/1529880/


All Articles