The use of universal_newlines in subprocess

  • Thread starter Joel Andres Granados
  • Start date
J

Joel Andres Granados

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,211
Members
47,848
Latest member
Alfonso227

Latest Threads

Top