Skip to content Skip to sidebar Skip to footer

How To Debug An Application Without Using An Ide And Without Understanding Of The Program Flow?

I'm trying to modify the code of naive bayes classifier provided by the excellent book Programming Collective Intelligence, adapting it to the GAE datastore (the provided code uses

Solution 1:

You've got a type error which should be simple to find but you seem to be making a false choice between running it on a deployment server or in your IDE.

There is a GAE development server which you run locally and it simulates the deployment environment.

Throw away your IDE, run against the development server, use print liberally to ensure that the values are what you expect them to be radiating out from the source of the error.

An IDE is no substitute for understanding what the code is doing, and relying upon one puts a layer of separation between you and your code which only makes debugging more difficult.

Solution 2:

Depending on the IDE you are going to find it hard to use an integrated debugger from the IDE. Typically they don't have the environment set up to support the appengine runtime (hence the import error you got, you will get other errors too.)

If you include this code at the top of the file you are interested in

def set_trace():
    import pdb, sys
    debugger = pdb.Pdb(stdin=sys.__stdin__,
        stdout=sys.__stdout__)
    debugger.set_trace(sys._getframe().f_back)

and then put a set_trace() any where in you code and run under the dev_server your code will be interrupted at that point and then you can use pdb debugger.

Solution 3:

From the code you included, I think the error is for this line:

res = fc.count

You should try use

res = fc.count()

As count is a method of GqlQuery instead of a property.

Post a Comment for "How To Debug An Application Without Using An Ide And Without Understanding Of The Program Flow?"