June 3, 2012
Logging shell commands outputs with python
The analysis of sequencing data (at least in the first steps) is often a matter of starting multiple scripts one after an other.
I found out that to log the stdout and the stderr with python was not that much obivous for me. I struggled quite a bit with the logging module but finally I came with the following.
import os import subprocess import logging import logging.handlers import datetime as dt class ShellLaunchAndLog: ''' logging of shell commands output ''' def __init__(self): self.
Read more