Testing whether imported function failed

brianc at temple.edu brianc at temple.edu
Tue Jun 8 18:12:48 CEST 2004

To all,

I have to make a lot of calls to a C++ library binded to python. 
The problem is that the functions/methods don't raise
exceptions when they fail to do their job. Instead they return
a 0 for a failure and a 1 for a successful completion.
>>> do_something(object)
>>> do_something(object)

I spent two days tracking down a bug that could have easily
been found if the call loudly failed. Is there anyway to
blanket test this integer 1/0 output so I can catch these
errors before they become untraceable?

Thank you,

More information about the Python-list mailing list