Generating a thread dump from python

cster csterry at mail.com
Wed Sep 12 14:26:03 EDT 2001


I am using a python script to run a java command.
When the java command hangs, I would like to issue a 'kill -3' to the java.
Anybody know how this can be done?

The following is happening in a thread in my python script:
--------- snip -----------
def run( self ) :
  outFile = os.popen('java com.foo.bar.class')

  logFile = open(  logFileName )

  # Read the output as it comes in.
  while 1 :
    s = outFile.readline()
    if not s : break
    logFile.write(s)
    logFile.flush()

    if self.timedOut.isSet() :
        logFile.close()
        outFile.close()
        raise SystemExit

logfile.close()
returnCode    = outFile.close()






More information about the Python-list mailing list