title: How can I capture iSight frames with Python in Snow Leopard?
body: <p>I have the following PyObjC script:</p>
  
  <pre><code>from Foundation import NSObject
  import QTKit
  error = None
  capture_session = QTKit.QTCaptureSession.alloc().init()
  print 'capture_session', capture_session
  device = QTKit.QTCaptureDevice.defaultInputDeviceWithMediaType_(QTKit.QTMediaTypeVideo)
  print 'device', device, type(device)
  success = device.open_(error)
  print 'device open success', success, error
  if not success:
      raise Exception(error)
  capture_device_input = QTKit.QTCaptureDeviceInput.alloc().initWithDevice_(device)
  print 'capture_device_input', capture_device_input, capture_device_input.device()
  success = capture_session.addInput_error_(capture_device_input, error)
  print 'session add input success', success, error
  if not success:
      raise Exception(error)
  capture_decompressed_video_output = QTKit.QTCaptureDecompressedVideoOutput.alloc().init()
  print 'capture_decompressed_video_output', capture_decompressed_video_output
  class Delegate(NSObject):
      def captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_(self, captureOutput, videoFrame, sampleBuffer, connection):
          print videoFrame, sampleBuffer, connection
  delegate = Delegate.alloc().init()
  print 'delegate', delegate
  capture_decompressed_video_output.setDelegate_(delegate)
  print 'output delegate:', capture_decompressed_video_output.delegate()
  success = capture_session.addOutput_error_(capture_decompressed_video_output, error)
  print 'capture session add output success', success, error
  if not success:
      raise Exception(error)
  print 'about to run session', capture_session, 'with inputs', capture_session.inputs(), 'and outputs', capture_session.outputs()
  capture_session.startRunning()
  print 'capture session is running?', capture_session.isRunning()
  import time
  time.sleep(10)
  </code></pre>
  
  <p>The program reports no errors, but iSight's green light is never activated and the delegate's frame capture callback is never called. Here's the output I get:</p>
  
  <pre><code>$ python prueba.py 
  capture_session &lt;QTCaptureSession: 0x1006c16f0&gt;
  device Built-in iSight &lt;objective-c class QTCaptureDALDevice at 0x7fff70366aa8&gt;
  device open success (True, None) None
  capture_device_input &lt;QTCaptureDeviceInput: 0x1002ae010&gt; Built-in iSight
  session add input success (True, None) None
  capture_decompressed_video_output &lt;QTCaptureDecompressedVideoOutput: 0x104239f10&gt;
  delegate &lt;Delegate: 0x10423af50&gt;
  output delegate: &lt;Delegate: 0x10423af50&gt;
  capture session add output success (True, None) None
  about to run session &lt;QTCaptureSession: 0x1006c16f0&gt; with inputs (
      "&lt;QTCaptureDeviceInput: 0x1002ae010&gt;"
  ) and outputs (
      "&lt;QTCaptureDecompressedVideoOutput: 0x104239f10&gt;"
  )
  capture session is running? True
  </code></pre>
  
  <p>PS: Please don't answer I should try PySight, I have but it won't work because Xcode can't compile CocoaSequenceGrabber in 64bit.</p>