Changed exception syntax to work with Python 2.5.