You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-140039: Improve ZoneInfo error messages with detailed guidance
This commit enhances the error messages when a timezone key is not found
in the zoneinfo module by using PEP-678 exception notes to provide clear,
actionable guidance to users.
Key improvements:
- Uses PEP-678 add_note() for better error message formatting
- Checks if tzdata package is actually missing before suggesting installation
- Provides different messages for missing tzdata vs incorrect timezone keys
- Uses hyphens instead of unicode bullet points for better compatibility
- Changes 'e.g.' to 'for example' for clarity
- Removes OS timezone data message that was confusing for Windows users
The error message now intelligently detects whether:
1. tzdata is not installed (suggests: pip install tzdata)
2. tzdata is installed but key is wrong (suggests: verify the key)
This makes debugging timezone issues much easier for Python developers.
0 commit comments