Skip to content

Commit 36677ba

Browse files
committed
Address review feedback: simplify error message wording
- Change 'To resolve this:' to 'Try:' to avoid implying guaranteed solution - Remove else block as ZoneInfoNotFoundError is clear enough without extra notes - Simplify message structure for better readability
1 parent 43da66c commit 36677ba

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Lib/zoneinfo/_common.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,13 @@ def load_tzdata(key):
2424
import tzdata
2525
except ImportError:
2626
# tzdata is not installed, provide installation instructions
27-
exc.add_note(
28-
"This error may occur if timezone data is not available. "
29-
"To resolve this:"
30-
)
31-
exc.add_note(" - Install the tzdata package: python -m pip install tzdata")
32-
exc.add_note(" - Verify the timezone key is correct (for example, 'America/New_York')")
27+
exc.add_note("This error may occur if timezone data is not available.")
28+
exc.add_note("Try:")
29+
exc.add_note(" - Installing the tzdata package: python -m pip install tzdata")
30+
exc.add_note(" - Verifying the timezone key is correct (for example, 'America/New_York')")
3331
exc.add_note("")
3432
exc.add_note("For more information, see:")
3533
exc.add_note("https://docs.python.org/3/library/zoneinfo.html")
36-
else:
37-
# tzdata is installed but the key wasn't found
38-
exc.add_note(f"The timezone key '{key}' was not found in the tzdata package.")
39-
exc.add_note("Please verify the timezone key is correct (for example, 'America/New_York').")
4034

4135
raise exc
4236
except (FileNotFoundError, UnicodeEncodeError, IsADirectoryError):

0 commit comments

Comments
 (0)