How to control Raspberry Pi PiNoIR camera via python?
Question: I have a PiNoIR camera for a Raspberry Pi (using Raspbian), and I'd like to
control it through a python script. I tried to use the `picamera` python (2.7)
library, but it doesn't work. The camera is enabled in Raspberry Pi, and it
seems to work well (as tested by `raspivid -t 0` in the terminal). However,
this simple python script freezes all the time and even `CTRL+C` is unble to
stop the process, I need to terminate it from a new window by `sudo kill`

    
    
    import time
    import picamera
    with picamera.PiCamera() as camera:
        camera.start_preview()
        time.sleep(2)
        camera.capture('/home/pi/test.jpg')
        camera.stop_preview()
    

The same script works fine with the standard (non infrared) Pi Camera though.
The documentation <http://picamera.readthedocs.org/en/release-1.5/#> doesn't
seem to say anything specific about the PiNoIR camera board.

Any thoughts? Thanks.


Answer: Remove the line: camera.stop_preview(). You can then stop the running script
with `Ctrl`+`F6`

