Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

It is a block buffering issueblock buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour until the buffer overflows.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour until the buffer overflows.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour until the buffer overflows.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 
added 27 characters in body
Source Link
jfs
  • 417.2k
  • 210
  • 1k
  • 1.7k

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour until the buffer overflows.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour until the buffer overflows.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path]) 
Source Link
jfs
  • 417.2k
  • 210
  • 1k
  • 1.7k

It is a block buffering issue: when stdout is redirected to a pipe parent.py accumulates its output in an internal buffer (~4K-8K) i.e., you won't see anything for around an hour.

To disable buffering, pass -u command-line option:

#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE, STDOUT script_path = os.path.join(get_script_dir(), 'parent.py') p = Popen([sys.executable, '-u', script_path], stdout=PIPE, stderr=STDOUT, bufsize=1) with p.stdout: for line in iter(p.stdout.readline, b''): print line, p.wait() 

See:

Note: if you don't need to do anything with the output then just drop stdout=PIPE, to see the output in the console:

subprocess.check_call([sys.executable, script_path])