I have a command line tool (actually, several) that I am writing a wrapper for in Python. 

The tool is generally used like this:

```
 $ path_to_tool -option1 -option2 > file_out

```

The user gets the output written to file\_out, and is also able to see various status messages of the tool as it is running. 

I want to replicate this behavior, while also logging stderr (the status messages) to a file. 

What I have is this:

```
from subprocess import call
call(['path_to_tool','-option1','option2'], stdout = file_out, stderr = log_file)

```

This works fine EXCEPT that stderr is not written to the screen. 
I can add code to print the contents of the log\_file to the screen of course, but then the user will see it after everything is done rather than while it is happening. 

To recap, desired behavior is:

1. use call(), or subprocess()
2. direct stdout to a file
3. direct stderr to a file, while also writing stderr to the screen in real time as if the 
tool had been called directly from the command line.

I have a feeling I'm either missing something really simple, or this is much more complicated than I thought...thanks for any help!

EDIT: this only needs to work on Linux.