title: In Python+OpenCV, how do I test cv.CaptureFromFile return value for failure?
body: <p>I'm using the Python bindings to OpenCV. If I pass a nonexistent (or bad) file to cv.CaptureFromFile(), how do I test the return value for failure?  In the C/C++ API, cvCaptureFromFile() returns NULL. In Python, I get: "&lt;Capture (nil)&gt;"</p>
  
  <p>How do I test for "&lt;Capture (nil)&gt;"?  </p>
  
  <pre><code>capture = cv.CaptureFromFile( infilename )
  # capture != None on failure so this doesn't work.
  if capture is None :
      print "Unable to open \"{0}\"".format( infilename )
      sys.exit(1) 
  </code></pre>
  
  <p>I could use os.stat() but that wouldn't help with cases where the file exists but OpenCV genuinely cannot decode the file (e.g., codec error).</p>