Python guide and API reference#

The Python API exposes the same exception hierarchy as the C++ API through nanobind. Every exception is a subclass of IsaacSimException, which is itself a subclass of the built-in Exception.

Summary#

  • IsaacSimException

  • PrimPathError

  • PrimPathStringError

  • AttributeNameError

  • ValueTypeError

IsaacSimException#

Catch IsaacSimException to handle any exception raised by Isaac Sim code without depending on a specific exception subtype:

from isaacsim.common.exceptions import IsaacSimException

try:
    ...
except IsaacSimException as error:
    print(str(error))

PrimPathError#

Raised when a USD prim path does not refer to a usable prim. Exposes the offending path through prim_path:

from isaacsim.common.exceptions import PrimPathError

try:
    ...
except PrimPathError as error:
    print(error.prim_path)

PrimPathStringError#

Raised when a string does not parse as a valid USD prim path. Exposes the offending string through prim_path:

from isaacsim.common.exceptions import PrimPathStringError

try:
    ...
except PrimPathStringError as error:
    print(error.prim_path)

AttributeNameError#

Raised when a caller references an attribute name that does not exist or is not accepted. Exposes the offending name through attribute_name.

ValueTypeError#

Raised when a value’s type does not match the type expected for an attribute. Exposes attribute_name, expected_type, and actual_type:

from isaacsim.common.exceptions import ValueTypeError

try:
    ...
except ValueTypeError as error:
    print(f"{error.attribute_name}: expected {error.expected_type}, got {error.actual_type}")