Take the 2-minute tour ×
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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
I'm getting same error, even in python prompt it give the same. –  maestromani Apr 26 '12 at 13:05
You must have a version mismatch. Have you tried another machine? Or a virtual machine? –  Christopher Jul 24 '12 at 19:16
add comment

Your Answer


