Can I start pdb debugging right away?

I want to debug a python project

The problem is that I don’t know where to set the breakpoint,

what i want to do is call the method

SomeClass( some_ctor_arguments ).some_method()` 

and immediately release the debugger

How to do it?

I tried pdb.run( string_command ), but it does not work correctly

>>> import pdb
>>> import <some-package>
>>> pdb.run( .... )
> <string>(1)<module>()
(Pdb) s
NameError: "name '<some-package>' is not defined"
+5
source share
2 answers

Found.

pdb.runcall( object.method )
+5
source
pdb.set_trace()

will launch the debugger at this point.

Put it at the beginning of the method you want to debug.

+4
source

All Articles