The use of universal_newlines in subprocess

Joel Andres Granados joel.granados at gmail.com
Tue May 22 11:00:48 EDT 2007


Hi list:

I have been working with the universal_newlines option that can be 
specified while using the subprocess module.   I'm calling an app that 
uses sys.stdout.write('\r'+' '*80) to manage its stdout.  The situation 
that I encountered was that when I wanted to log this output into a file 
it looked rather freaky, so I needed to change the way the output was 
logged.  I found the answer in the universal_newlines option (it 
basically changed all the \r for \n, which is a good idea in my case).  
When I read the documentation for the universal_newline it stated that 
"Also, the newlines attribute of the file objects stdout, stdin and 
stderr are not updated by the communicate() method.".  So I did not use 
the communicate method thinking that it could not be used for my 
purpose.  After some hours of trying to make it work without the 
communicate method I decide to use it and to my surprise it worked.  So 
my question is what does " are not updated by the communicate() method " 
mean in the documentation.

Thanx in advance.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: joel.granados.vcf
Type: text/x-vcard
Size: 150 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070522/0450d4ae/attachment.vcf>


More information about the Python-list mailing list