views:

392

answers:

5

Hi,

besides from using a completely integrated IDE with debugger for python (like with Eclipse), is there any little tool for achieving this:

  • when running a program, i want to be able to hook somewhere into it (similar to inserting a print statement) and call a window with an object inspector (a tree view)
  • after closing the window, the program should resume

It doesnt need to be polished, not even absolutely stable, it could be introspection example code for some widget library like wx. Platform independent would be nice though (not a PyObjC program, or something like that on Windows).

Any Ideas ?

Edit: Yes, i know about pdb, but I'm looking for a graphical tree of all the current objects.

Nevertheless, here is a nice introduction on how to use pdb (in this case in Django): pdb + Django

A: 

You can use ipython, with the %debug statement. Once your code crashes, you can add breakpoints, see objects etc. A very crude way to kickoff the debugger is to raise Exception at some line of your code, run it in ipython, the type %debug when it crashes.

Peter
+3  A: 

pdb isn't windowed, it runs in a console, but it's the standard way to debug in Python programs.

Insert this where you want to stop:

import pdb;pdb.set_trace()

you'll get a prompt on stdout.

Ned Batchelder
A: 

If a commercial solution is acceptable, Wingware may be the answer to the OP's desires (Wingware does have free versions, but I don't think they have the full debugging power he requires, which the for-pay versions do provide).

Alex Martelli
+3  A: 
nosklo
Thank you, that looks quite promising, and behaves nicely in a first test.. I'll have to figure out how to use it with Django, could be a nice tool :-) (and debugs itself, which is kinda funny.)
Homer J. Simpson
+1  A: 

Python Debugging Techniques is worth reading. and it's Reddit's comment is worth reading too. I have really find some nice debug tricks from Brian's comment. such as this comment and this comment.
Of course, WingIDE is cool (for general Python coding and Python code debugging) and I use it everyday. unlucky for WingIDE still can't embedded a IPython at now.

sunqiang