class canlib.kvlclib.Converter(filename, file_format)[source]

A kvlclib converter

This class wraps all kvlclib functions related to converters, and saves you from keeping track of a handle and passing that to the functions.

kvlcCreateConverter and kvlcDeleteConverter are not wrapped as they are called when Converter objects are created and deleted, respectively. However, if it is necessary to force the converter to write its files, flush can be used to simulate destroying and recreating the converter object.

  • filename (str) – Name of output file

  • file_format (FileFormat | WriterFormat) – A supported output format


No more than 128 converters can be open at the same time.

Changed in version 1.18: The file_format parameter now accepts WriterFormat as well.


Get truncation status.

Deprecated since version 1.5: Use isDataTruncated instead.


Check if the converter has created a new file.

Deprecated since version 1.5: Use isOutputFilenameNew instead.


Get overrun status.

Deprecated since version 1.5: Use isOverrunActive instead.

addDatabaseFile(filename, channel_mask)[source]

Add a database file.

Converters with the property Property.SIGNAL_BASED will match events against all entries in the database and write signals to the output file.

  • filename (str) – Path to database file (.dbc)

  • channel_mask (ChannelMask) – Channels to use database on


Attach file to be included in the output file.

E.g. used to add a database or a movie to the output.

Note that the output format must support the property Property.ATTACHMENTS.


filename (str) – Path to file to be attached


Convert next event.

Convert one event from input file and write it to output file.


Get extimated number of events left.

Get the estimated number of remaining events in the input file. This can be useful for displaying progress during conversion.


Feed one event to the converter.

Used when reading log files directly from device.


Prepare for new file

Notify the converter that next event in feedLogEvent() will come from another file. Used when reading log files directly from device.

E.g. use this function with FileFormat.MEMO_LOG when using KVMLIB to read events from a Kvaser Memorator connected to USB.

New in version 1.18.


Recreate the converter so changes are saved to disk

Converters do not write changes to disk until they are deleted. This method deletes and recreates the underlying C converter, without needing to recreate the Python object.


Return a dictionary with id, DLC with number of mismatched messages

If any DLC mismatch occurred during conversion (which can be seen using isDlcMismatch) this function returns a dictonary with the tuple message id and message DLC as key, and the number of times that triggered the mismatch as value.


Get the filename of the current output file.


Get current value for a writer property.


wr_property (Property) – Writer property to get


Get default property.

Deprecated since version 1.5: Use WriterFormat.getPropertyDefault instead.


Get truncation status.

Truncation occurs when the selected output converter can’t write all bytes in a data frame to file. This can happen if CAN FD data is extracted to a format that only supports up to 8 data bytes, e.g. FileFormat.KME40.

Truncation can also happen if Property.LIMIT_DATA_BYTES is set to limit the number of data bytes in output.


True if data has been truncated


Get DLC mismatch status.

DLC mismatch occurs when a CAN id is found in the database but the DLC differs from the DLC in the message.


Check if the converter has created a new file.

This is only true once after a a new file has been created. Used when splitting output into multiple files.


Get overrun status.

Overruns can occur during logging with a Memorator if the bus load exceeds the logging capacity. This is very unusual, but can occur if a Memorator runs complex scripts and triggers.


Check if specified wr_property is supported by the current format.

Deprecated since version 1.5: Use WriterFormat.isPropertySupported instead.


Select next input file.


Reset DLC mismatch status.


Reset overrun status.


Reset data trunctation status.

setInputFile(filename, file_format)[source]

Select input file.

  • filename (string) – Name of input file

  • file_format (FileFormat | ReaderFormat) – A supported input format

Changed in version 1.16: The file_format parameter now accepts ReaderFormat as well.

Changed in version 1.18: If filename is None, the format for feedLogEvent is set.

setProperty(wr_property, value)[source]

Set a property value.


wr_property (Property) – Writer property to be set