On this page
calendar.IllegalMonthError
Prev: calendar.HTMLCalendar | Up: calendar | Next: calendar.IllegalWeekdayError
Rel: calendar.calendar, calendar.Calendar, calendar.Day, calendar.firstweekday
Ref: docs.python.org โ calendar.IllegalMonthError
Tags: #public #python3 #stdlib #calendar
Import
import calendar
from calendar import IllegalMonthError
Signature & Overview
calendar.IllegalMonthError(month)
calendar.IllegalMonthError class.
Methods & Attributes
IllegalMonthError.add_note(self, note, /)โ Add a note to the exceptionIllegalMonthError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import calendar
try:
calendar.monthrange(2026, 13)
except calendar.IllegalMonthError:
assert True
Gotchas
- Subclass of
ValueError: Raised when a month is outside1..12.
REPL Inspect
from calendar import IllegalMonthError
help(IllegalMonthError)
Linked from
Related notes
- tuts/python3/stdlib_module/calendar/HTMLCalendar Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/IllegalWeekdayError Linked here; links to this page; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/calendar Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Calendar_class Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/Day Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/firstweekday Linked here; shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/calendar/isleap shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/leapdays shared tags: #calendar, #stdlib
- tuts/python3/stdlib_module/calendar/LocaleHTMLCalendar shared tags: #calendar, #stdlib