use the newer code pattern with as
except Exception as e: