Core interface

This part of the documentation covers ltapy’s core interface to the LightTools API.

Configuration

This module holds the available configuration options for the package.

ltapy.config.JS_VERSION = 'LTCOM64.JSNET'

Default version of the JumpStart macro function library.

ltapy.config.LT_VERSION = '8.5.0'

Default LightTools version.

ltapy.config.TIMEOUT = 60

Timeout in seconds after that a connection attempt to LightTools is aborted.

Exceptions

This module contains the LightTools exception classes.

exception ltapy.error.LightToolsError

Bases: Exception

Base class for all LightTools exceptions.

exception ltapy.error.TimeOutError

Bases: ltapy.error.LightToolsError

Raised when a connection attempt to LightTools was aborted due to timeout.

exception ltapy.error.APIError(ltapi, status)

Bases: ltapy.error.LightToolsError

Raised when a LightTools API function returns a nonzero error code.

Parameters:
  • ltapi (ILTAPIx) – Handle to the LightTools session.
  • status (int) – Status code of the LightTools API function call.

JumpStart library

This module provides access to the JumpStart macro function library.

ltapy.jslib.js = <win32com.gen_py.LightTools and JumpStart COM API 3.1._JSNET instance>

A global, single instance of the JumpStart macro function library.

Session

This module provides connection capabilities to LightTools.

class ltapy.session.Session(pid=None, timeout=60, _rebuild=False)

Connect to a running LightTools session.

Create a connection to a running LightTools session, using Python as client program. The lt attribute provides a handle to the connected session.

Parameters:
  • pid (int, optional) – The process ID of an already running LightTools session. If pid is given connect to that specific session, otherwise connect to an arbitrary session.
  • timeout (int, optional) – The time limit in seconds after which a connection attempt to LightTools is aborted.
lt

ILTAPIx – A handle to the LightTools session.

Raises:TimeOutError – If a connection attempt with LightTools was aborted due to timeout.

Examples

Connect to a running LightTools session by specifying the PID of the LightTools process.

>>> ses = Session(pid=5642)
>>> lt = ses.lt
>>> lt.Message("Successfully connected to LightTools!")
classmethod new(version='8.5.0', timeout=60, _rebuild=False)

Start a new LightTools instance and connect to that session.

Parameters:
  • version (str, optional) – The LightTools version to be started.
  • timeout (int, optional) – The time limit in seconds after which the connection attempt to LightTools is aborted.
Returns:

A session object, connected with the newly created

LightTools instance.

Return type:

Session

Raises:

TimeOutError – If a connection attempt with LightTools was aborted due to timeout.

Examples

Start a new LightTools instance and connect to that session:

>>> ses = Session.new(version="8.5.0")
>>> lt = ses.lt
>>> lt.Message("Successfully connected to LightTools!")