From <http://docs.python.org/library/functions.html#open>

> 
> The optional bufsize argument
>  specifies the file’s desired buffer
>  size: 0 means unbuffered, 1 means line
>  buffered, any other positive value
>  means use a buffer of (approximately)
>  that size. A negative bufsize means to
>  use the system default, which is
>  usually line buffered for tty devices
>  and fully buffered for other files. If
>  omitted, the system default is used.
> 
> 
> 

I'm passing 0 as bufsize below yet without using flush() there's no output written to the file when I run main\_process.  

What's the reason?

```
# --------------------------------- sub_process.py
import sys
import time

if __name__ == '__main__':
    print 'printed from redirect.py'
    # why is the following flush() needed? 'std-output' is (?) unbuffered...
    sys.stdout.flush() 
    time.sleep(6)

# --------------------------------- main_process.py
import subprocess
import time

if __name__ == '__main__':
    p = subprocess.Popen(
        ['python', 'sub_process.py'],
        stdout=open('std-output', 'w', 0))
    time.sleep(3)
    p.terminate()

```