I am using the python module os to run some command line tool inside the puthon script:

```
os.system("ToolName")

```

Sometimes it may give me errors and warnings but it writes them to console. Is there a way to redirect the writing of these messages to some .txt file ?