make sure to use the exact error that would be raise here like:

except IpythonError: