icalendar.error module#

Errors thrown by icalendar.

exception icalendar.error.BrokenCalendarProperty[source]#

Bases: InvalidCalendar

A property could not be parsed and its value is broken.

This error is raised when accessing attributes on a vBroken property that would normally be present on the expected type. The original parse error is chained as __cause__.

exception icalendar.error.ComponentEndMissing[source]#

Bases: IncompleteAlarmInformation

We are missing the end of a component that the alarm is for.

Use Alarms.set_end().

exception icalendar.error.ComponentStartMissing[source]#

Bases: IncompleteAlarmInformation

We are missing the start of a component that the alarm is for.

Use Alarms.set_start().

exception icalendar.error.FeatureWillBeRemovedInFutureVersion[source]#

Bases: DeprecationWarning

This feature will be removed in a future version.

exception icalendar.error.ICalParsingError(message, line=None, line_number=None, value=None)[source]#

Bases: InvalidCalendar

Could not parse an iCalendar.

exception icalendar.error.IncompleteAlarmInformation[source]#

Bases: ValueError

The alarms cannot be calculated yet because information is missing.

exception icalendar.error.IncompleteComponent[source]#

Bases: ValueError

The component is missing attributes.

The attributes are not required, otherwise this would be an InvalidCalendar. But in order to perform calculations, this attribute is required.

This error is not raised in the UPPERCASE properties like .DTSTART, only in the lowercase computations like .start.

exception icalendar.error.InvalidCalendar[source]#

Bases: ValueError

The calendar given is not valid.

This calendar does not conform with RFC 5545 or breaks other RFCs.

exception icalendar.error.JCalParsingError(message, parser='', path=None, value=<object object>)[source]#

Bases: InvalidCalendar

Could not parse a part of the JCal.

Create a new JCalParsingError.

Parameters:
  • message (str) – A description of the error that occurred while parsing.

  • parser (str | type) – The parser class or its name where the error occurred.

  • path (list[str | int] | None | str | int) – The location in the jCal structure where the error occurred.

  • value (object) – The value which caused the error, if available.

classmethod reraise_with_path_added(cls, *path_components)[source]#

Automatically re-raise the exception with path components added.

Raises:

JCalParsingError – If there was an exception in the context.

Return type:

Generator[None, None, None]

classmethod validate_jcal_token(name, kind, parser='', path=None)[source]#

Validate a jCal name as a lowercase iCalendar token.

jCal keeps a property name, parameter name, or RRULE part name verbatim and re-emits it into the content line on serialization, so a :, ;, or lone carriage return in the name could inject parameters or a new content line. A valid name matches the iCalendar token pattern [\w.-]+ and, per RFC 7265, must be lowercase.

Parameters:
  • name (str) – The jCal name to validate.

  • kind (str) – Names the token in the error message, for example, "property name".

  • parser (str | type) – The parser or component to which the name belongs.

  • path (list[str | int] | None | str | int) – The jCal path to name, used to locate it in the error.

Raises:

JCalParsingError – If name is not a valid lowercase iCalendar token.

See also

validate_token()

Return type:

None

classmethod validate_list_type(jcal, expected_type, parser='', path=None)[source]#

Validate the type of each item in a jCal list.

Return type:

None

classmethod validate_property(jcal_property, parser, path=None)[source]#

Validate a jCal property.

Parameters:
  • jcal_property (list[object]) – A list with at least four items (name, parameters, value type, and value) which is the jCal property to be validated.

  • parser (str | type) – The parser class or its name where the error occurred.

  • path (list[str | int] | None | str | int) – The location in the jCal structure where the error occurred.

Raises:

JCalParsingError – if the property is not valid.

Return type:

None

classmethod validate_value_type(jcal, expected_type, parser='', path=None)[source]#

Validate the type of a jCal value.

Return type:

None

exception icalendar.error.LocalTimezoneMissing[source]#

Bases: IncompleteAlarmInformation

We are missing the local timezone to compute the value.

Use Alarms.set_local_timezone().