Strange problem running python program from within ant


 
Thread Tools Search this Thread
Operating Systems AIX Strange problem running python program from within ant
# 1  
Old 12-20-2013
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:
Code:
#!/usr/bin/python
import hashlib


ant_test.xml:
Code:
<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:
Code:
$ 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
# 2  
Old 12-22-2013
[SOLVED] Strange problem running python program from within ant

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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strange fork error while running script

more run.sh !/bin/bash input="data.txt" while IFS= read -r var do startdir="/web/logs" searchterm=$(echo $var | awk -F'=' '{print $1}') replaceterm=$(echo $var | awk -F'=' '{print $2}') find "$startdir" -type f -exec grep -l "$searchterm" {} + | while read file do if sed -e... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Red Hat

Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-la

Have no idea on what the below error message is: Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -buildfile build.xml dist. Any help? (3 Replies)
Discussion started by: gull05
3 Replies

3. Programming

Python program

Can someone help me please to write a Python program that support a processing of arithmetic expressions in postfix notation. Expressions in postfix notation contain the operands on which the operation is performed followed by an operator. For example, 3 4 + is equal to 3 + 4 in the infix... (2 Replies)
Discussion started by: Jim-266
2 Replies

4. UNIX for Dummies Questions & Answers

Problem in running ant on unix

Hello, I am trying to run ant from a shell script a.sh. a.sh is placed in the /usr/myScripts folder a.sh looks like .......... ${ANT_HOME}/bin/ant -myBuild.xml While trying to run a.sh i am getting /usr/modules/apache.ant_1.7.1 /bin/ant: No such file or directory. Can anyone tel me... (5 Replies)
Discussion started by: naneee
5 Replies

5. Shell Programming and Scripting

RSH connection problem while running MPI program

I'm trying to run MPI programs on 8 machines, but I get the error connect to address 127.0.0.1 port 544: Connection refused Trying krb4 rsh... connect to address 127.0.0.1 port 544: Connection refused trying normal rsh (/usr/bin/rsh) lagrid02: Connection refused When I run it with a... (8 Replies)
Discussion started by: vishwamitra
8 Replies

6. Shell Programming and Scripting

Running C# program problem

Hi All, How to run c# program using shell script ? (1 Reply)
Discussion started by: srikar.ch
1 Replies

7. Shell Programming and Scripting

Problem running a program/script in the background from a script

Hi all, I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion. My problem is sometimes the program takes... (5 Replies)
Discussion started by: newbie_01
5 Replies

8. Programming

Python program faster than C++ program.

I wrote a simple program that generates a random word 10,000,000 times. I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Discussion started by: cbreiny
2 Replies

9. UNIX for Advanced & Expert Users

Functionality of ant build and ant deploy unix commands

I have made some code changes in the corresponding java file for date formatting purpose so that it supports upgraded sybase version from 12.6 to 12.7 and have build the code and deployed using the following UNIX commands. ant build ant deploy. "ant build" executes the build.xml which is... (1 Reply)
Discussion started by: vmpcit
1 Replies

10. UNIX for Dummies Questions & Answers

Strange Program behaviour

Had a strange thing going on with my code. It's ok I figured it out for myself.... (2 Replies)
Discussion started by: mrpugster
2 Replies
Login or Register to Ask a Question