Update used try and except sintax to become python3 compatible