printwriter in JAVA to pass to python
<p>I have a code in JAVA and i need in python, the code is it:</p>

<pre><code>private static PrintWriter logWriter;  //Only one instance to access log file.
PrintWriter.write() manages the lock.
static{
    try{
        logWriter = new PrintWriter(new FileOutputStream(logTextFileName,true));
    }catch(Exception e){

    }
}

private static Object lockLogWriter = new Object();
/**
 * Returns the object used to write to the log File. If closed, creates a new instance
*/
private static PrintWriter getLogWriter(){
    if (logWriter.checkError()){
        synchronized (lockLogWriter){
            logWriter.close();
            try{
                logWriter = new PrintWriter(new FileOutputStream(logTextFileName,true));
             }catch (Exception ex){
            }
        }
    }
      return logWriter;
}
</code></pre>

<p>But i do not know what is the equivalent of prinwriter, Object, FileOutputstream and sinchronized</p>
