views:

265

answers:

2
File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in <module>
  import libxml2mod

    ImportError: /usr/local/lib/python2.5/site-packages/libxml2mod.so: 
    undefined symbol:xmlTextReaderSetup

>>> import libxml2mod
>>> import libxml2
>>>

on Python Prompt it works fine !!

can anyone has idea why my program is not working from .py file as import is working perfect from python prompt.

+2  A: 

I can only suggest that your paths are different for some reason. Either that, or you are not using the same python interpreter in both cases.

I have experienced this when I happen to have a couple of interpreters, and the wrong one is either default, or specified in the #! section of the script.

Christopher
A: 

same problem for me :(

ninja123
if its working from python prompt then try to print libxml2mod.__file__and also put same print in your .py file and validate if they both are called from same library path.
Tumbleweed