Hi,
As per you suggestion I have set PYTHONPATH.
Now the issue is different.
[root@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@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@redhat.com]
Sent: Thursday, January 25, 2018 8:23 PM
To: Abinaya Sandhiya Manikandan (GIS) <abinaya.manikandan(a)wipro.com>
Cc: libguestfs(a)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(a)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
https://clicktime.symantec.com/a/1/9c_A59DlXs2MB010_pFlKJc62fLY-YzkAYXvh1...
Read my programming and virtualization blog:
https://clicktime.symantec.com/a/1/5xScP5pWckKftplgoFq_lSHjFyxqid1DdNafcc...
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_MbXDHa71g2uIyj7...
______________________________________________________________________
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
______________________________________________________________________