Don't use deprecated syntax for "except"

And remove trailing whitespace.