[Tutor] python 2.3.4, how to use os.system and collect it's output to a file.

Alan Gauld alan.gauld at btinternet.com
Tue Aug 2 19:14:47 CEST 2011


On 02/08/11 16:40, Thirupathaiah Gande (tgande) wrote:

> I want to use os.system command and collect a command’s output to a
> file. But it is not collecting all the output. It is truncating..

no its not truncating anything, it is returning the exit code of the 
command, because thats what os.system does.

You need to look at the Subprocess module to read/write to processes.
The documentation shows many examples of usage, but if you have specific 
problems come back here.

HTH,

Alan G.


More information about the Tutor mailing list