En Mon, 20 Oct 2008 06:15:34 -0200, Gatis <[EMAIL PROTECTED]> escribió:
I wrote script that in case of some event takes picture using usb webcam [Creative Live! Cam Vista IM (VF0420)] and command line utility v4lctl (from package xawtv). Problem1: To catch error and info messages from script I used: sys.stdout = open('/tmp/log','a') sys.stderr=sys.stdout All writes to log file well, except v4lctl error messages. If script is run from commandline, than v4lctl error messages are shown there. How to catch these messages?
Use the subprocess module to invoke the external program; see http://docs.python.org/library/subprocess.html specially the examples at the end.
Problem2: When script is run from /etc/init.d (in runlevel 2) during boot, no pictures are taken. I can't tell error message, because of Problem1. If I execute now v4lctl from commandline (while my script is running in background), picture is taken.
Once you start using subprocess, you could write to some file what you get from the communicate() method - the error messages, if any, should be there.
-- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list