Script Container

SourceElement

class canlib.canlib.SourceElement(name, contents)
property contents

Alias for field number 1

property name

Alias for field number 0

Txe

class canlib.canlib.Txe(path)[source]

The Txe class provides an interface to compiled t programs (.txe) files.

New in version 1.6.

property compiler_version

t compiler version number.

Type:

VersionNumber

property date

Compilation date and time.

Type:

datetime.datetime

property description

t program description.

Type:

str

property file_version

.txe binary format version number.

Type:

VersionNumber

property is_encrypted

true if the source and byte-code sections of the .txe binary have been encrypted.

Type:

bool

property path

Path of compiled t program (.txe) file.

Type:

str

property size_of_code

Size in bytes of byte-code section.

Type:

int

property source

Yields name and content of the source files used to create the .txe binary file.

If the t source files used to create the .txe binary was included at compilation time, then this attribute will yield SourceElement tuples containing the name and content of the individual source files.

Sample usage:

for name, contents in txe.source:
  print('file name:{} contents:{}'.format(name, contents))

If the source and byte-code sections of the .txe binary have been encrypted then it’s not possible to parse the source list and a TxeFileIsEncrypted exception will be raised.

If no source files have been included in the .txe binary then an empty iterator is returned.

Yields:

SourceElement – Name and contents tuple.

Raises:

TxeFileIsEncrypted – If the source and byte-code sections of the .txe binary have been encrypted.