[Python-il] debugging Python
cben at users.sf.net
Sun Jan 24 14:11:59 IST 2010
On Fri, Jan 22, 2010 at 17:18, Amit Aronovitch <aronovitch at gmail.com> wrote:
> In case you did not try that yet, using an interactive interpreter is
> tremendous help for testing out new ideas and especially when learning new
> IDE's come with their own interactive prompts, but you always have the
> included python shell (just type "python" at the command line), as described
> in most tutorials.
> Even easier solution - use ipython: has colors, improved history and much
> much more.
IMHO, the interactive interpreter become tremendously more useful when
it multi-line history, so that you can type a whole loop or function
definition, try it out, and then recall and modify it with a single
Unfortunately, 90% of python environments don't do this (e.g. the
plain "python" interpreter) or do it wrong (e.g. ipython, which is is
great in all other respects)...
So I recommend you start out with IDLE which comes builtin with
Python. It's not very fancy, but it does get multi-line history
> IDE's also have graphic debuggers (probably built as wrappers around pdb).
> Do not have much experience with the python IDE's mentioned in previous
> posts. IDLE (the "standard" tk IDE included with python) has some debugging
> support - single stepping and jumping through source files work nicely, but
> last time I checked (long time ago) running programs with debug mode on in
> IDLE is quite slow and tends to get it stuck.
IDLE's GUI debugger sucks, don't use it. It's confusing and lets you
do only very basic stuff.
I still recommend you start with IDLE, due to its great interactive prompt.
Learn to use the command-line pdb in "post-mortem" mode:
All you need to get started debugging exceptions are "bt", "up",
"down" and "p <expression>" to check variables and test pieces of
If you must have a GUI debugger, see http://winpdb.org/about/.
P.S. if you use Windows, http://pythonxy.com is an excellent "fat"
distro which will give you tons of developement tools and packages,
with one install and easy updates.
P.P.S. see also http://stackoverflow.com/search?q=python+IDE. If you
are not famaliar with StackOverflow - you should be! Many questions
like this are already answered there, and if not, just ask them and
you'll get quality answers in hours, or sometimes minutes!
Beni Cherniavsky-Paskin <cben at users.sf.net>
More information about the Python-il