I have a simple script that import xml.parsers.expat, that works fine if it is executed by command line. But if I call it using subprocess.call(python import-expat.py, shell=True) it does not work.
The script is:
#! /usr/bin/env python
import xml.parsers.expat
And It is the error:
File "/opt/u_script_files/import-expat.py", line 2, in <module> import xml.parsers.expat
File "/usr/lib/python2.7/xml/parsers/expat.py", line 4, in <module> from pyexpat import *
ImportError: /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt
I verify the dependencies with:
$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
linux-vdso.so.1 => (0x00007ffd9b392000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1608877000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f16084b2000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f1608288000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1608ca6000)
And searched the file "libexpat.so.1"
$ apt-file search libexpat.so.1
libexpat1: /lib/x86_64-linux-gnu/libexpat.so.1
libexpat1: /lib/x86_64-linux-gnu/libexpat.so.1.6.0
I dont understand why it works only by CommandLine and It does not work if I call the script(import-expat.py) using subprocess.call. I renamed the file "libexpat.so.1" as said here but it does not work for me. Some ideas?