painful debugging: techniques?

Thomas Heller theller at python.net
Wed Apr 7 14:04:35 EDT 2004


David Bolen <db3l at fitlinxx.com> writes:

> "Humpty Dumpty" <oliver.schoenborn at utoronto.ca> writes:
>
>> I'm wondering if there are tricks people use to track down problems like
>> this.
>
> Perhaps not so much a trick as much as experience, but after working
> with Python a bit, you'll find that any time you see something like
> 'NoneType not a callable' (or really any type) it pretty much says
> that some object in your program should be a callable (function,
> method, etc..) but is None (or the other type) instead.  So in general
> I'd immediately start looking for uses of None in my code (or ways in
> which my code could generate None at runtime).

It may be that the OP forgot an explicit 'return' statement in a
function, so that the function returns None instead of a callable
object.  In this case, there is a chance that pychecked would have spit
out a warning.

Thomas





More information about the Python-list mailing list