[Libguestfs] python 3 bindings on libguestfs
Richard W.M. Jones
rjones at redhat.com
Wed Jan 24 14:31:02 UTC 2018
On Wed, Jan 24, 2018 at 09:13:22AM +0000, abinaya.manikandan at wipro.com wrote:
> Hello,
>
> Please fine below details:
>
> [root at server190 ~]$ cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 6.5 (Santiago)
>
> We are trying to import guestfs in python according to manual page:
> http://libguestfs.org/guestfs-py
>
> I should be able to initialize guestfs with following command:
> import guestfs
> g = guestfs.GuestFS(python_return_dict=True)
> g.add_drive_opts("disk.img", format="raw", readonly=1)
> g.launch()
>
> But I could see below issue:
> [root at server190~]$ python
> Python 3.5.1 (default, Feb 18 2016, 07:20:42)
> [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import guestfs
> >>> g = guestfs.GuestFS(python_return_dict=True)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: module 'guestfs' has no attribute 'GuestFS'
>
> Can you please suggest us how to fix this issue.
...
> [root at server190 ~]$ guestfish --version
> guestfish 1.32.10
>
> We have enable python3 bindings on libguestfs according to below guide:
> http://libguestfs.org/guestfs-building.1.html#building-python-2-and-python-3-bindings
It looks like you've compiled your own version of libguestfs
from source.
Did you run ‘make install’? It's best NOT to do that.
You can access the python bindings from the compiled source directory
using:
./run python
as described here:
http://libguestfs.org/guestfs-building.1.html#the-.-run-script
If that doesn't work then you need to send the full output from
‘./configure && make’ when you build libguestfs.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
More information about the Libguestfs
mailing list