-
Notifications
You must be signed in to change notification settings - Fork 16
Python development
libexe comes with Python-bindings named pyexe.
Below are examples how use pyexe. They assume you have a working version of pyexe on your system. To build pyexe see Building.
To be able to use pyexe in your Python scripts add the following import:
import pyexe
The get_version() module function can be used to retrieve the version of the pyexe.
pyexe.get_version()
This will return a textual string (Unicode) that contains the libexe version. Since pyexe is a wrapper around libexe it does not have a separate version.
exe_file = pyexe.file()
exe_file.open("cmd.exe")
...
exe_file.close()
The explicit call to exe_file.close() is not required. Close only must be called once all operations on the file have been completed.
file_object = open("cmd.exe", "rb")
exe_file = pyexe.file()
exe_file.open_file_object(file_object)
...
exe_file.close()
The explicit call to exe_file.close() is not required. Close only must be called once all operations on the file have been completed and will not close the file-like object itself.
import pyexe
help(pyexe)
help(pyexe.file)