Changing except syntax to python 3 (2.6 compatible)