The problem may be that the command you are running in the subprocess buffers its output: in which case, in Blender's answer, the process.stdout. Read(1) would not return until the output buffer of the subprocess filled up, causing it to be flushed, and thus seen by the parent process.
The problem may be that the command you are running in the subprocess buffers its output: in which case, in Blender's answer, the process.stdout. Read(1) would not return until the output buffer of the subprocess filled up, causing it to be flushed, and thus seen by the parent process. See this answer and this one for more information about how buffering affects things.
Here's some scripts to illustrate: # spew. Py import sys import time for I in range(10): print 'Message no. %d' % I #sys.stdout.flush() time.
Sleep(1) and # runspew. Py import subprocess import time start = time.time() p = subprocess. Popen('python', 'spew.Py', stdout=subprocess.
PIPE) data = p.stdout. Read(1) print 'Elapsed time to first byte read: %.2f' % (time.time() - start) data = p.stdout.read() print 'Elapsed time to last byte read: %.2f' % (time.time() - start) p.wait() Now, put both scripts in the same directory and run python runspew.py. You'll see something like this: Elapsed time to first byte read: 10.05 Elapsed time to last byte read: 10.05 Now, remove the comment from sys.stdout.flush() in spew.
Py and do python runspew. Py again. You'll now see something like this: Elapsed time to first byte read: 0.02 Elapsed time to last byte read: 10.04 Notice that runspew.
Py didn't change: only the program which was run as the subprocess did. If the program you're running can't be made to run unbuffered (or flush frequently), then you'll have to use expect/unbuffer as described in the other answers I linked to.
I made a Python shell implementation once, so here's the code I used to run commands. It ran wget and nano fine, so I think the code would suit your needs: process = subprocess. Popen(shlex.
Split(command), stdout = subprocess. PIPE, stderr = subprocess. STDOUT) while True: output = process.stdout.
Read(1) if output == '' and process.poll()! = None: break if output! = '': sys.stdout.
Write(output) sys.stdout.flush() Basically, you have to write directly into stdout.
– myusuf3 Jun 6 at 20:59 The key really is to call sys.stdout.flush(), otherwise Python will continue buffering output. – zeekay Jun 6 at 20:59 @dustyprogrammer, I don't actually know XD. I checked my code, and this is the only time it's even used.
Time to cut off a vestigial organ... – Blender Jun 6 at 21:01.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.