![]() |
|
|
|
#11 |
|
wrote:
> hi, > I am new to Python programming.I am not getting exactly pdb.Can > anyone tell me effective way to debug python code? > Please give me any example. > Looking for responce. > Thank You. > Sushant If you are having issues you also might want to try: http://pychecker.sourceforge.net/ and see if it finds your problem. You might get lucky. Or just make the bigger install: http://stani.be/python/spe/blog/ that one already includes pychecker and a python debugger. Sorry for the noise if you were just looking for instructions for pdb. pruebauno@latinmail.com |
|
|
|
|
#12 |
|
Posts: n/a
|
Dennis Lee Bieber <> writes:
> My typical debugging technique is the infamous "wolf fence" (there's > one wolf in Alaska, how do you find it? First build a fence down the > middle of the state, wait for the wolf to howl, determine which side of > the fence it is on. Repeat process on that side only, until you get to > the point where you can see the wolf). In other words; put in a few > "print" statements until you find the statement that is failing (then > maybe work backwords from the "tracks" to find out where the wolf/bug > comes from). I think the advantage of this method is that one has to become clear what the state of the program should look like. For the same reason, unit tests may help to develop a proper specification of the task of a module. However, pdb's port mortem debugging can be helpful when a program takes a lot of time to hit the error, and a large amount of data is in play, for example for numerical computations. Johannes Johannes Nix |
|
|
|
#13 |
|
Posts: n/a
|
I don't have an example, but what I do is insert:
import pdb pdb.set_trace() before the code that I think is causing the problem (or that the traceback barfed at). Then hit 'l' (lowercase L) to get a list of the code which is being executed. Use 'p' to look at variables. eg p some_local Use 'n' to execute the current line of code (doesn't follow method or function calls) Use 's' to step through code, including following function and method calls. Finally, 'c' to continue execution as normal. There are other options, but that should get you started. And look at the article linked elsewhere in this thread. pdb - because fencing off Alaska is too damn slow, binary search or not. jtm james.wondrasek@gmail.com |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How To Access HTML elements in code behind??? | nedums_b | Software | 1 | 02-07-2008 07:15 PM |
| Code Monkey want MCTS, Code Monkey take exam | Zimri | MCTS | 0 | 04-03-2007 10:57 PM |
| Circumvent Region Code | hufaunder@yahoo.com | DVD Video | 11 | 01-29-2007 09:51 PM |
| .avi files giving region code error | Craig Cameron | DVD Video | 2 | 03-07-2006 02:49 PM |
| Change region code and PAL to NTSC? | Aloke Prasad | DVD Video | 0 | 02-26-2004 01:54 PM |