-
Notifications
You must be signed in to change notification settings - Fork 5
Python development
libvsmbr comes with Python-bindings named pyvsmbr.
Below are examples how use pyvsmbr. They assume you have a working version of pyvsmbr on your system. To build pyvsmbr see Building.
To be able to use pyvsmbr in your Python scripts add the following import:
import pyvsmbr
The get_version() module function can be used to retrieve the version of the pyvsmbr.
pyvsmbr.get_version()
This will return a textual string (Unicode) that contains the libvsmbr version. Since pyvsmbr is a wrapper around libvsmbr it does not have a separate version.
vsmbr_volume = pyvsmbr.volume()
vsmbr_volume.open("image.raw")
...
vsmbr_volume.close()
The explicit call to vsmbr_volume.close() is not required. Close only must be called once all operations on the volume have been completed.
file_object = open("image.raw", "rb")
vsmbr_volume = pyvsmbr.volume()
vsmbr_volume.open_file_object(file_object)
...
vsmbr_volume.close()
The explicit call to vsmbr_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.
import pyvsmbr
help(pyvsmbr)
help(pyvsmbr.volume)