views:

194

answers:

2

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"
+4  A: 

Found it ..

pdb.runcall( object.method )
hasen j
Didn't know you could do that, thanks!
itsadok
+4  A: 
pdb.set_trace()

will start the debugger at this point.

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

Oli