kme files

createKme()

canlib.kvmlib.createKme(path, filetype=FileType.KME50)[source]

Create a KME file on the host computer

Parameters:
  • path (str) – The full filepath for the .KME file (e.g. "data/mylog.kme50").

  • filetype (FileType) – The KME file type

Returns:

Kme

New in version 1.7.

openKme()

canlib.kvmlib.openKme(path, filetype=FileType.KME50)[source]

Open a KME file on the host computer

Parameters:
  • path (str) – The full filepath for the .KME file (e.g. "data/mylog.kme50").

  • filetype (FileType) – The KME file type

Returns:

Kme

New in version 1.7.

Kme

class canlib.kvmlib.Kme(handle)[source]

A kme file

A class representing a KME file. The main use is twofold:

Either we create a KME file using createKme and would like to write events using Kme.write_event:

with kvmlib.createKme('out/data.kme50') as kme:
    ...
    kme.write_event(my_logevent)

Or we read events from an existing KME file:

with kvmlib.openKme('in/data.kme50') as kme:
    event = kme.read_event()
    ...
    print(event)

Note that only KME files of type KME50 and KME60 may currently be written to.

New in version 1.7.

Changed in version 1.20: Added experimental support for KME60.

close()[source]
estimate_events()[source]

Estimate how many events the KME file contains

Returns:

int: Approximate number of events in KME file.

New in version 1.7.

Deprecated since version 1.11.

event_count_estimation()[source]

Returns an approximation of the number of events contained in the KME file.

Returns:

int: Approximate number of events in KME file.

New in version 1.11.

events()[source]
read_event()[source]

Read logevent from KME file

Returns:

memoLogEventEx

New in version 1.7.

write_event(logevent)[source]

kme_file_type()

canlib.kvmlib.kme_file_type(path)[source]

Scan KME file and report version

Open and read the file path and try to decode what version of KME it contains.

Parameters:

path (str) – The full filepath for the .KME file (e.g. "data/mylog.kme").

Returns:

FileType – The KME file type

New in version 1.7.