compatibility with python 3.x

using "as" keyword in except instead of comma ","