[Libguestfs] python 3 bindings on libguestfs

abinaya.manikandan at wipro.com abinaya.manikandan at wipro.com
Thu Jan 25 15:09:47 UTC 2018


Hi,

As per you suggestion I have set PYTHONPATH.
Now the issue is different.

[root at euca-172-31-15-221 ~]$ echo $PYTHONPATH
/opt/libguestfs/x86_64/1.32.10/lib64:/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages/:
[root at euca-172-31-15-221 ~]$ python
Python 3.6.0 (default, Jun  1 2017, 02:10:02)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/opt/libguestfs/x86_64/1.32.10/lib64', '/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages', '/root', '/opt/python/x86_64/3.6.0-1/lib/python36.zip', '/opt/python/x86_64/3.6.0-1/lib/python3.6', '/opt/python/x86_64/3.6.0-1/lib/python3.6/lib-dynload', '/opt/python/x86_64/3.6.0-1/lib/python3.6/site-packages']
>>> import guestfs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages/guestfs.py", line 73, in <module>
    import libguestfsmod
ModuleNotFoundError: No module named 'libguestfsmod'
>>>

Thanks in Advance!

Regards,
Abinaya sandhiya

-----Original Message-----
From: Richard W.M. Jones [mailto:rjones at redhat.com]
Sent: Thursday, January 25, 2018 8:23 PM
To: Abinaya Sandhiya Manikandan (GIS) <abinaya.manikandan at wipro.com>
Cc: libguestfs at redhat.com
Subject: Re: [Libguestfs] python 3 bindings on libguestfs

** This mail has been sent from an external source **

On Thu, Jan 25, 2018 at 01:31:09PM +0000, abinaya.manikandan at wipro.com wrote:
> Hi,
>
> We are trying to build libguestfs RPM package using SPEC file.

This is new information, and good that's how you should be building libguestfs on RHEL or CentOS.

...
> 4. We could see python-guestfs libraries in below path,
>
> [root at euca-172-31-15-221 site-packages]$ pwd
> /opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages
> [root at euca-172-31-15-221 site-packages]$ ls guestfs.py  guestfs.pyc
> guestfs.pyo
>
> We are able to import guestfs without any issue like below:
> [root at euca-172-31-15-221 ~]$ python
> Python 3.6.0 (default, Jun  1 2017, 02:10:02) [GCC 4.4.4 20100726 (Red
> Hat 4.4.4-13)] on linux Type "help", "copyright", "credits" or
> "license" for more information.
> >>> import guestfs
> >>>
>
> But the issue is when we use "GuestFS" attribute like below:
> >>> guestfs.GuestFS()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'guestfs' has no attribute 'GuestFS'
>
> I have tried a lot to fix the issue and also google the same but no luck.
> Please help me on this.

I'm going to guess that your Python binary is not looking in /opt/libguestfs/... for libraries.

You could see if setting PYTHONPATH helps, ie. something like this:

  PYTHONPATH=/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages python

You can also print the current path from python by doing:

  >>> import sys
  >>> print (sys.path)

Rich.

--
Richard Jones, Virtualization Group, Red Hat https://clicktime.symantec.com/a/1/9c_A59DlXs2MB010_pFlKJc62fLY-YzkAYXvh16AOpY=?d=EZBVgACryOgmgSiTnWoITWU669d-iIPJFrFFXkG--ivACJE8jZyUaq4fIeuM71eW6WK-0Levcf_1P4ulsJQ9NPsrAD1zEvNioK0X5UkfUa99OKEjOoSktYYiocD0QW2p26YaK4sgIKd4PXpq-kGYuIlCkrXJTk12J2mRJS4Ia6njujow-G-Q1aEgiOcIamhqG54GA8xXJ-h9shqXiS0uwbT7k60yuXX9ZoThoFdaKOX52Pc_as8ioh_wc6jDP-qb726shcoRXxwPXNeoGLIZ0_xuwal0hAxG-p3kLkSQTMBFhiiYtniekTYTCezslx2pMPKrU2Lpkog5antuP76vMzn_XBItRCALU0FfmphWLTxqVqwUDt_RRTVR&u=http%3A%2F%2Fpeople.redhat.com%2F~rjones
Read my programming and virtualization blog: https://clicktime.symantec.com/a/1/5xScP5pWckKftplgoFq_lSHjFyxqid1DdNafcc_iO9I=?d=EZBVgACryOgmgSiTnWoITWU669d-iIPJFrFFXkG--ivACJE8jZyUaq4fIeuM71eW6WK-0Levcf_1P4ulsJQ9NPsrAD1zEvNioK0X5UkfUa99OKEjOoSktYYiocD0QW2p26YaK4sgIKd4PXpq-kGYuIlCkrXJTk12J2mRJS4Ia6njujow-G-Q1aEgiOcIamhqG54GA8xXJ-h9shqXiS0uwbT7k60yuXX9ZoThoFdaKOX52Pc_as8ioh_wc6jDP-qb726shcoRXxwPXNeoGLIZ0_xuwal0hAxG-p3kLkSQTMBFhiiYtniekTYTCezslx2pMPKrU2Lpkog5antuP76vMzn_XBItRCALU0FfmphWLTxqVqwUDt_RRTVR&u=http%3A%2F%2Frwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc.
https://clicktime.symantec.com/a/1/aLTR835iB8IenUdS8cS8i6_MbXDHa71g2uIyj7Zi3uQ=?d=EZBVgACryOgmgSiTnWoITWU669d-iIPJFrFFXkG--ivACJE8jZyUaq4fIeuM71eW6WK-0Levcf_1P4ulsJQ9NPsrAD1zEvNioK0X5UkfUa99OKEjOoSktYYiocD0QW2p26YaK4sgIKd4PXpq-kGYuIlCkrXJTk12J2mRJS4Ia6njujow-G-Q1aEgiOcIamhqG54GA8xXJ-h9shqXiS0uwbT7k60yuXX9ZoThoFdaKOX52Pc_as8ioh_wc6jDP-qb726shcoRXxwPXNeoGLIZ0_xuwal0hAxG-p3kLkSQTMBFhiiYtniekTYTCezslx2pMPKrU2Lpkog5antuP76vMzn_XBItRCALU0FfmphWLTxqVqwUDt_RRTVR&u=http%3A%2F%2Fpeople.redhat.com%2F~rjones%2Fvirt-top

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________




More information about the Libguestfs mailing list