⚡ Solution Summary

  • Import statements for error handling were incorrect
  • Fix released in version 14.0.1
  • Ensure to upgrade to the latest version.
### Describe the bug API documentation suggests using `stripe.error.SomeError` but current modules are not importable as described. [API Doc](https://docs.stripe.com/api/errors/handling?api-version=2025-11-17.preview&rds=1) ### To Reproduce ```shell >>> import stripe.error Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'stripe.error' >>> from stripe import error Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'error' from 'stripe' >>> import stripe.error.CardError Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'stripe.error' >>> import stripe >>> stripe.error.CardError Traceback (most recent call last): File "/.../python3.12/site-packages/stripe/__init__.py", line 872, in __getattr__ target, is_submodule = _import_map[name] ~~~~~~~~~~~^^^^^^ KeyError: 'error' ``` ### Expected behavior ```repl >>> import stripe >>> stripe.error.CardError <class 'stripe._error.CardError'> ``` ### Code snippets ```Python ``` ### OS macOS ### Language version Python 3.12 ### Library version stripe-python v14.0.0 ### API version 2025-11-17.clover ### Additional context _No response_

Discussion & Fixes

prathmesh-stripe 2025-11-21
Thanks for reporting this and submitting a PR. These import statements are generated by our code generator. We will be making these changes and ship a fix soon.
prathmesh-stripe 2025-11-22
Fix for this has been released in https://github.com/stripe/stripe-python/releases/tag/v14.0.1

Get updates

We publish verified fixes weekly. No spam.

Subscribe