VerifyEmailError not defined after installing verify_email library (Python 3.11.5)

I am using Python 3.11.5 and installed the verify_email library to validate email addresses. However, when I attempt to catch the VerifyEmailError exception using a try-except block, I receive the following error:

except verify_email.VerifyEmailError as e:
AttributeError: module 'verify_email' has no attribute 'VerifyEmailError'

I have tried uninstalling and reinstalling the verify_email library multiple times, but the issue persists.


  • The verify-email does not throw an exception if a verification failed. Thus there is not exception you can import.

    from verify_email import verify_email
    print(verify_email(some_wrong_email)) # => False
    print(verify_email(some_right_email)) # => True

    You can use that to check if an email is correct and do something if it is or isn't

    from verify_email import verify_email
    if verify_email(some_email):
        # Do something with correct email
        # Do something with wrong email