mapteksdk.errors module

Low level errors thrown by the functions in the SDK.

Users of the mapteksdk package should never throw these errors. Rather, they are made available here to enable users to catch and handle them.

exception ApplicationTooOldError

Bases: Exception

Error raised if the application is too old to use certain functionality.

Typically, this error indicates that the connected application is missing functionality which is required for the function which threw the exception to be used. In this case, upgrading the application to the newest version should resolve the error.

The other case where this error will be raised is if the Python Script has connected to an application which does not officially support the Python SDK. In this case, switching to the newest version of an application which officially supports the Python SDK should resolve the error.

Examples

The main reason to catch this exception is if a script uses functionality which may not be supported by all target applications but it is still possible for the script to complete successfully (likely with reduced functionality). For example, the below fragment demonstrates how a script could read the edge thickness of an EdgeNetwork, defaulting to an edge thickness of 1.0 if the application doesn’t support the property.

>>> try:
...     thickness = edge_network.edge_thickness
>>> except FunctionNotSupportedError:
...     # Treat the edge thickness as 1 if the application does not support
...     # reading it.
...     thickness = 1.0
classmethod with_default_message(feature)

Construct a ApplicationTooOldError with the default message.

The message will suggest that feature is not supported.

Parameters:

feature (str) – The feature which is not supported. This should start with a capital letter and not start with a full stop.

Return type:

Self

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ImportFormatNotSupportedError

Bases: Exception

Importing a file is not supported by the connected application.

This may be because the application is too old for Python to be able to access the import functionality, or it may be because the connected application cannot import the given format.

classmethod from_path(path)

Construct from a path.

Parameters:

path (pathlib.Path)

Return type:

Self

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception FileImportError

Bases: Exception

Error raised when an import of a file fails.

classmethod from_error_message(path, messages)

Construct an import error from a sequence of error messages.

Parameters:
Return type:

Self

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception FileImportWarning

Bases: Warning

Warning emitted when an import cannot be performed correctly.

Typically, objects will still be imported from the file, but some information form the file may be lost.

classmethod from_warning_message(path, warnings)

Construct an import error from a sequence of warning messages.

Parameters:
Return type:

Self

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception NoScanDataError

Bases: Exception

The imported scan contains no data.

The scan may be “image-only”.

classmethod from_path(path)
Parameters:

path (pathlib.Path)

Return type:

Self

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.