Raising exception on STDIN read

Michael Goerz newsgroup898sfie at 8439.e4ward.com
Wed Feb 27 11:25:46 EST 2008


Hi,

I would like to raise an exception any time a subprocess tries to read 
from STDIN:

latexprocess = subprocess.Popen( \
         'pdflatex' + " " \
          + 'test' + " 2>&1", \
         shell=True, \
         cwd=os.getcwd(), \
         env=os.environ, \
         stdin=StdinCatcher() # any ideas here?
     )

An exception should be raised whenever the pdflatex process
reads from STDIN... and I have no idea how to do it. Any suggestions?

Thanks,
Michael



More information about the Python-list mailing list