On Thu, Jan 25, 2018 at 01:31:09PM +0000, abinaya.manikandan@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@euca-172-31-15-221 site-packages]$ pwd /opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages [root@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@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 http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top