François Pinard <pin...@iro.umontreal.ca> wrote:

> ... 
> This is more similar to my actual usage, which really is:
> 
>         [...]
>         write = sys.stderr.write
>         for line in os.popen('emacs 2>&1 -batch'
>                              ' -l ~/fp/notes/publish.el'
>                              ' -f org-publish-all'):
>             write(repr(line) + '\n')
>             sys.stderr.flush()
>             [...]
> 
> The write(...) and the flush() are only there for debugging: I wanted to
> see if the lines are delivered timely or not (and I'm seemingly getting
> the Emacs output in one blow).  I just do not understand why the
> behavior differs between the "... | cat" line and the Python excerpt.
> I'm surely missing something somewhere...  Sigh!
> 

I would recommend that you chuck the obsolete os.popen() permanently and
learn the subprocess module: you will be much happier. Setting bufsize=0
(which is the default) should give you unbuffered output from the process.

Nick


Reply via email to