The Fix
pip install stripe==14.4.0a2
Based on closed stripe/stripe-python issue #1158 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -174,6 +174,9 @@ def __getattr__(name):
return _api_resources
+ raise AttributeError(
+ f"module {__name__!r} has no attribute {name!r}"
+ )
>> import stripe
>> stripe.checkout.Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'Session'
>> print(stripe.checkout)
None
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: This fix is not applicable if the behavior of __getattr__ is intentionally designed to return None.\n\n
Why This Fix Works in Production
- Trigger: >> import stripe
- Mechanism: The module-level __getattr__ incorrectly returns None instead of raising an AttributeError
- Why the fix works: Fixes the issue where `stripe.checkout` is `None` after importing the stripe module by raising an AttributeError instead of returning None. (first fixed release: 14.4.0a2).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Shows up under Python 3.8 in real deployments (not just unit tests).
- The module-level __getattr__ incorrectly returns None instead of raising an AttributeError
- Surfaces as: >> import stripe
Proof / Evidence
- GitHub issue: #1158
- Fix PR: https://github.com/stripe/stripe-python/pull/1159
- First fixed release: 14.4.0a2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.63
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thank you for the report, it's a bug that checkout is not available right after importing stripe. We are working on it.”
“I already found the underlying issue. The module-level __getattr__ needs to raise AttributeError rather than falling off the end and returning None: - #1159”
Failure Signature (Search String)
- >> import stripe
Error Message
Stack trace
Error Message
-------------
>> import stripe
>> stripe.checkout.Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'Session'
>> print(stripe.checkout)
None
Minimal Reproduction
>> import stripe
>> stripe.checkout.Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'Session'
>> print(stripe.checkout)
None
Environment
- Python: 3.8
Why It Broke
The module-level __getattr__ incorrectly returns None instead of raising an AttributeError
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install stripe==14.4.0a2
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/stripe/stripe-python/pull/1159
First fixed release: 14.4.0a2
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if the behavior of __getattr__ is intentionally designed to return None.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 14.4.0a2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.