python - How do I retrieve stderr for a shell command with a large data buffer? -
The Python subprocess module describes the function:
Note < p> If the read data is buffered in memory, then do not use this method if the data size is large or unlimited.
How can I execute a process that reads a lot of data (such as communication (Contraindicated)) and yet still has the stderr output used?
'stdout / stadder output is available as an individual to receive unlimited sub-process, You can use it: twisted.internet import protocol from twisted.internet import protocol
#! / Usr / bin / env python process protocol (protocol processing protocol): dff reset (self, data): print 'foundout found:', data df error received (self, data): print 'done stacker:', data DF processed (self, cause): reactor.stop () process = process protocol () reactor. SpanProcess (Process, 'CMD', ['CMD', 'AGR1', 'AGR2']) Reactor r.run ()
An alternative is to use thread, e.g. ., Or OS specific code eg., On POSIX systems or usage.
Comments
Post a Comment