Raise the expected exception for python 2.5

I don't know much about python but the current code looks wrong :)