Skip Montanaro <[EMAIL PROTECTED]> added the comment:
>> Using a nonzero bufsize parameter makes all the difference in the
>> world:
...
In fact, looking at posix_popen in posixmodule.c it appears the default
value for bufsize there is -1, implying that I/O is fully buffered.
Even if the default bufsize value for subprocess.Popen is not changed its
documentation should be corrected to reflect the different default values
for bufsize between os.popen and subprocess.Popen:
Replacing os.popen*
-------------------
pipe = os.popen(cmd, mode='r', [bufsize])
==>
pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout
If you use the default bufsize with os.popen you must set bufsize to -1
when creating a Popen object. Otherwise your I/O will be unbuffered and
you will be disappointed at the I/O performance.
----------
assignee: -> georg.brandl
components: +Documentation, Library (Lib)
nosy: +georg.brandl
versions: +Python 2.7, Python 3.0
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4194>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com