Strange problem running python program from within ant

Hello,

I'm currently trying to port an ant based build to AIX 6.1. The build queries the underlying version control system (Mercurial) for some data, which works fine on other platforms (Linux, Solaris). However, on AIX the hg command fails to load python's md5 module when used in the build, while it works fin in the shell. I could reproduce the problem with a simple test setup, consisting of test.py and ant_test.xml:

test.py:

#!/usr/bin/python
import hashlib

ant_test.xml:

<project name="ant_test" default="python">
        <target name="python" >
                <exec executable="./test.py" failifexecutionfails="true" failonerror="true"/>
        </target>
</project>

When I run test.py from the shell, it works fine, but when I run the ant build, it fails:

$ ls -l
total 16
-rw-r--r--    1 dhs      usr             170 Dec 20 15:46 ant_test.xml
-rwxr-xr-x    1 dhs      usr              35 Dec 20 09:54 test.py
$ ./test.py
$ echo $?
0
$ ant -f ant_test.xml
Buildfile: /home/RECOMMIND/dhs/tmp/ant_test.xml

python:
     [exec] Traceback (most recent call last):
     [exec]   File "./test.py", line 3, in <module>
     [exec]     import hashlib
     [exec]   File "/opt/freeware/lib/python2.6/hashlib.py", line 136, in <module>
     [exec]     md5 = __get_builtin_constructor('md5')
     [exec]   File "/opt/freeware/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
     [exec]     import _md5
     [exec] ImportError: No module named _md5

BUILD FAILED
/home/RECOMMIND/dhs/tmp/ant_test.xml:3: exec returned: 1

Total time: 1 second

I currently have no idea how to resolve or even debug this, as AIX is somewhat new to me.

Versions:
AIX 6.1 TL08
Python 2.6.8 installed as RPM package obtained from perzl.org
Java is IBM JDK 7.1
Ant 1.8.4

Thanks in advance...

Dirk

Hi,

turned out that the JVM messes with $LIBPATH. After setting LIBPATH to /opt/freeware/lib (where the openssl libs are located), the python test program as well as hg work fine from within the ANT build.

Bye...

Dirk