RE: Accessing Parallel Port in Python Error : Priviledged Instruction
type your message here -- http://mail.python.org/mailman/listinfo/python-list
RE: Re: A World Beyond Capitalism 2005, An Annual International Multiracial Alliance Building Peace Conference Is Accepting Proposals...
You consider it spam because you don't agree with the political message or the idea of people working for a better world. However, if it had been a subject which was acceptable to your standards as a self-made moderator, then everything would have been wonderful in Kansas. Click your heels please, you're not in Kansas. People are going to work for a better world whether you like it or not. -- http://mail.python.org/mailman/listinfo/python-list
Your IP Address
html head titleYour IP address/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 style type=text/css !-- body { background-color: ##BBE1DF; } .style1 { font-size: 36px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; } -- /style/head body div align=center class=style1a href=http://www.ipimne.com;Your IP address br br www.ipimne.com/a/div /body /html -- http://mail.python.org/mailman/listinfo/python-list
Issues With Threading
Hello All, I'm having issues capturing the output from a program while using threading. Program runs ok when I run without threading. Here's my Python code and the Java class that is called by it. Python : #!/usr/bin/python import popen2 import threading for id in range( 10 ) : ( err_out, stdin ) = popen2.popen4( ( '/usr/bin/java JavaTest %s' ) % ( id ) ) for line in err_out.readlines() : print line, def test( id ) : print Called %s % ( id ) ( err_out, stdin ) = popen2.popen4( ( '/usr/bin/java JavaTest %s' ) % ( id ) ) for line in err_out.readlines() : print line, #for id in range( 10 ) : #thread = threading.Thread( target=test, args=( [ id ] ) ) #thread.start() Java : import java.util.Date; public class JavaTest { public static void main( String args[] ) { System.out.println( args[0] + - + new Date().toString() ); } } When I run without threading, I get the correct output : 0 - Tue Jul 12 11:33:51 EDT 2005 1 - Tue Jul 12 11:33:52 EDT 2005 2 - Tue Jul 12 11:33:52 EDT 2005 3 - Tue Jul 12 11:33:53 EDT 2005 4 - Tue Jul 12 11:33:53 EDT 2005 5 - Tue Jul 12 11:33:54 EDT 2005 6 - Tue Jul 12 11:33:54 EDT 2005 7 - Tue Jul 12 11:33:54 EDT 2005 8 - Tue Jul 12 11:33:54 EDT 2005 9 - Tue Jul 12 11:33:54 EDT 2005 When I uncomment the threading section and run again, I see that the function is called, but the result from the Java code does not get printed : Called 0 Called 1 Called 2 Called 3 Called 4 Called 5 Called 6 Called 7 Called 8 Called 9 I hope this is just a nuance that I've run across and it's an easy solution ... any advice pointing me in the right direction would be greatly appreciated. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Read System.out.println From Java Using popen ?
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