Skip to content

Python development

Joachim Metz edited this page Jul 14, 2022 · 2 revisions

libbde comes with Python-bindings named pybde.

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

Import

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

import pybde

Get version

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

pybde.get_version()

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

Open volume

Open a volume by path

bde_volume = pybde.volume()

bde_volume.open("image.raw")

...

bde_volume.close()

The explicit call to bde_volume.close() is not required. Close only must be called once all operations on the volume have been completed.

Open a volume using a file-like object

file_object = open("image.raw", "rb")

bde_volume = pybde.volume()

bde_volume.open_file_object(file_object)

...

bde_volume.close()

The explicit call to bde_volume.close() is not required. Close only must be called once all operations on the volume have been completed and will not close the file-like object itself.

Also see

import pybde

help(pybde)
help(pybde.volume)
Clone this wiki locally