hasen
hasen

Reputation: 166372

Can I make pdb start debugging right away?

I want to debug a python project

The problem is, I don't know where to set a break point,

what I want to do, is be able to call a method

SomeClass( some_ctor_arguments ).some_method()` 

and have the debugger be fired right away

How do I do that?

I tried pdb.run( string_command ) but it doesn't seem to work right

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

Upvotes: 5

Views: 1368

Answers (2)

Oli
Oli

Reputation: 15970

pdb.set_trace()

will start the debugger at this point.

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

Upvotes: 4

hasen
hasen

Reputation: 166372

Found it ..

pdb.runcall( object.method )

Upvotes: 5

Related Questions