Re: python debugging question



diffuser78@xxxxxxxxx writes:

I am a python newbie. I have writen some 500 lines of code. There are 4
classes and in all 5 files.

Now, I am trying to run the program. I am getting wrong values for the
simulation results.
Is there any debugging facilities in python which would let me go step
by step and check the values of the variables at every step. I have
done something like this in MS Visual Stdio 6.0 sometime back.

For python, I am using SPE.

what is a good way of debugging such large and iterative programs ? Any
tips.

Every help is appreciated.

Thanks

If you use my mkpythonproj:
http://www.seanet.com/~hgg9140/comp/index.html#L006
then you will have a test suite and a "debug" ftn ready to go.

For a brand new project, where you are exploring and don't know what
the test cases might be, you can just do the debug calls. Once you
know where you are headed (or if you got rqmts at the start) then
crank up some test cases and run that testsuite everytime you add a
few lines of code.

Start exploring or testing at the "hello, world" level, and gradually
add functionality (tests and code) as you go. This is MUCH easier
than writing a lot of code and then trying to debug it. You only need
to understand a few lines at a time.

In tens of thousands of lines of python code, I think I've used a
debugger (pdb) maybe once. We have some apps here that are one-off
quick hacks and others that are multi-person, multi-year efforts.
They all live by their test suites.

--
Harry George
PLM Engineering Architecture
.



Relevant Pages

  • Re: Python debug libraries
    ... >> Visual Studio says it can't find the debug version of the ... How should I get the debug libraries? ... ActiveState's Visual Python. ... I'm debugging I really need both. ...
    (comp.lang.python)
  • Re: please include python26_d.lib in the installer
    ... I want to build my own code in Debug mode for debugging. ... I don't want to build or use the debug version of Python. ... building a SWIG library in debug mode, ...
    (comp.lang.python)
  • Re: distutil and debugging
    ... I want to debug my own extention - not the python interpretor. ... and would prefer to stay there also while debugging... ... extensions are compiled without -g as well. ...
    (comp.lang.python)
  • Re: Best way of debigging a C extension
    ... this, as I don't have a debug build of Python - but that should be OK, ... You have to build Python on your own to get debug builds. ... Only debug builds allow to do extension debugging like memory leak finding. ...
    (comp.lang.python)
  • Re: Office or InDesign breaks VS 2005 debugging?
    ... Given tha I was using and debugging the sub-projects in this solution before ... some getting used to) and the debug symbols for the child project are no ...
    (microsoft.public.vsnet.debugging)