Thank you Daniel! So setting up the PYTHONPATH variable did the trick!
Although the simple test executes, but with an interesting error complaining
about an undefined symbol in libvirtmod.so
[root@lcgctb9 libvirt]# python testLibvirt.py
Traceback (most recent call last):
File "testLibvirt.py", line 1, in ?
import libvirt
File "/usr/local/lib/python2.3/site-packages/libvirt.py", line 7, in ?
import libvirtmod
ImportError: /usr/local/lib/python2.3/site-packages/libvirtmod.so: undefined
symbol: PyEval_ThreadsInitialized
Regards
Omer
On 12/19/06, Daniel P. Berrange <berrange(a)redhat.com> wrote:
On Tue, Dec 19, 2006 at 04:03:43PM +0100, Omer Khalid wrote:
> Hi,
>
> I am still unable to run my simple libvirt test!
>
> I checked out the code from libvirt cvs and following the instructions
till
> 'make install'. It all went well. So then I ran my simply python test,
as
> shown here (
http://www.libvirt.org/python.html). It keeps on giving me
the
> following error.
>
> [root@lcgctb9 libvirt]# python testLibvirt.py
> Traceback (most recent call last):
> File "testLibvirt.py", line 1, in ?
> import virt
> ImportError: No module named virt
The python modiule is called 'libvirt' not 'virt'.
>
> I have verified that the library is linked by the following:
>
> [root@lcgctb9 libvirt]# pkg-config libvirt --libs
> -L/usr/local/lib -lvirt -lxenstore
>
> [root@lcgctb9 libvirt]# pkg-config --variable=prefix libvirt
> /usr/local
Since you installed into /usr/local, I suspect you'll need to also set
PYTHONPATH environment variable to tell python to look there for modules
it loads. eg export PYTHONPATH=/usr/local/lib/python2.4/site-packages
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496
-=|
|=- Perl modules:
http://search.cpan.org/~danberr/
-=|
|=- Projects:
http://freshmeat.net/~danielpb/
-=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B
9505 -=|
--
---------------------------------------------------------------
CERN – European Organization for Nuclear Research
Information Technology Department
CH-1211 Geneva 23
Phone: +41 (0) 22 767 7996
Fax: +41 (0) 22 767 4900
E-mail : Omer.Khalid(a)cern.ch
Homepage:
http://cern.ch/Omer.Khalid