Hello All, I'm relatively new to Python programming but have been working on this problem for a little bit now ... I initially began writing UNIX scripts in Python and thought it was the greatest because I could do the following very easily :
pswwaux = os.popen( "ps wwaux | grep /usr/sbin/httpd" ) for line in pswwaux.readlines() : print line.strip() This made writing wrapper scripts for restarting servers ( and handling all the errors that may occur on a restart ... ) a snap ... now I'm trying to make a call to a Java service that utilizes System.out.println to say whether the action was performed, or if there were errors or any other piece of information ... I'm having issues reading what comes out of System.out.println, and I'm beginning to wonder if my Java service is being called at all and if so, is it even possible to capture System.out.println ? Here's the gist of my call to the Java service: result = os.popen( "%s/bin/java com.foo.service.JavaService %s" % ( JAVA_HOME, FILE_TO_CREATE ) ) print result.readlines() The result.readlines() always results in this output: [] Furthurmore, the file that is supposed to be created is not created ... If I replace the result = os.popen with a print, and then copy what the script prints out and run that ( straight up on the command line ), the file is created and the expected output is spit out ... It should be noted that I'm trying to loop over a list of files and create a Thread for each action since the Java service can take a bit of time to run : for id in ids : thread = threading.Thread( target=export, args=( [ id ] ) ) thread.start() So I guess my questions are: 1) Am I executing the Java service the correct way 2) Am I capturing the System.out.println from the Java service the correct way Any help would be greatly appreciated -- http://mail.python.org/mailman/listinfo/python-list