erikcw
erikcw

Reputation: 11057

"Watching" program being processed line-by-line?

I'm looking for a debugging tool that will run my Python app, but display which line is currently being processed -- like an automatically stepping debugger. Basically I want to see what is going on, but be able to jump in if a traceback occurs.

Upvotes: 1

Views: 244

Answers (6)

sharjeel
sharjeel

Reputation: 6005

Try IPython alongwith ipdb

Upvotes: 0

Christopher
Christopher

Reputation: 9084

There is also a very nice debugger in The Python Eclipse plugin.

Upvotes: 0

S.Lott
S.Lott

Reputation: 391848

"Basically I want to see what is going on, but be able to jump in if a traceback occurs."

Here's a radical thought: Don't.

"Watching" is a crutch. You should be writing small sections of code that you know will work. Then put those together.

Watching sometimes results from "I'm not sure what Python's really doing", so there's an urge to "watch" execution and see what's happening. Other times watching results from writing a script that's too big and complex without proper decomposition. Sometimes watching results from having a detailed specification which was translated into Python without a deep understanding. I've seen people doing these; of course, there are lots more reasons.

The advice, however, is the same for all:

  1. Break things into small pieces, usually classes of functions. Make them simple enough that you can actually understand what Python is doing.

  2. Knit them together to create your larger application from pieces you actually understand.

Watching will limit your ability to actually write working software. It will -- in a very real way -- limit you to trivial programming exercises. It's not a good learning tool; and it's a perfectly awful way to create production code.

Bottom Line.

Don't pursue "watching". Decompose into smaller pieces so you don't need to watch.

Upvotes: 1

Luper Rouch
Luper Rouch

Reputation: 9492

Winpdb is a good python debugger. It is written in Python under the GPL, so adding the automatic stepping functionality you want should not be too complicated.

Upvotes: 3

Zach Hirsch
Zach Hirsch

Reputation: 26101

I think you're looking for the pdb module.

Upvotes: 1

Amber
Amber

Reputation: 526573

The integrated debugger in Wing IDE is quite versatile and nice to work with. (The Wing IDE 101 version is freeware.)

Upvotes: 0

Related Questions