painful debugging: techniques?

Humpty Dumpty oliver.schoenborn at utoronto.ca
Tue Apr 6 23:18:29 EDT 2004


Hello, I've been using python for about 3 months now. Prior to that I did
C++ for over 5 years. I'm wondering if my debugging techniques are too C++
oriented.

E.g., it took me about 9 hrs of debugging to figure out that the second
parameter to weakref.ref() was being passed as None. This is odd because the
second parameter is optional, yet its default value is not documented, so I
assumed that passing None would be fine, and then I forgot that I was doing
that. It took that long mostly because the exception message was "Exception
TypeError: 'NoneType not a callable' in None being ignored", ie it was being
ignored and function from which it was being raised was unknown to Python
(somehow), *and* it was only being raised upon exit of the test (cleanup).
So I had no way of knowing where this was being raised. It was nasty.

I'm wondering if there are tricks people use to track down problems like
this.

Thanks,

Oliver





More information about the Python-list mailing list