Skip to content

Python development

Joachim Metz edited this page Jul 12, 2022 · 3 revisions

libevt comes with Python-bindings named pyevt.

Below are examples how use pyevt. They assume you have a working version of pyevt on your system. To build pyevt see Building.

Import

To be able to use pyevt in your Python scripts add the following import:

import pyevt

Get version

The get_version() module function can be used to retrieve the version of the pyevt.

pyevt.get_version()

This will return a textual string (Unicode) that contains the libevt version. Since pyevt is a wrapper around libevt it does not have a separate version.

Open file

evt_file = pyevt.file()

evt_file.open("AppEvent.evt")

evt_file.close()

The explicit call to evt_file.close() is not required.

Open file using a file-like object

file_object = open("AppEvent.evt", "rb")

evt_file = pyevt.file()

evt_file.open_file_object(file_object)

evt_file.close()

The explicit call to evt_file.close() is not required.

Also see

import pyevt

help(pyevt)
help(pyevt.file)

Clone this wiki locally