Error checking for python