use modern Exception "as"

Replace "," by "as" in exception.

add some PEP8