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