title: OpenCv - cv2.VideoWriter object has no attribute release
body: <p>I am using OpenCV with python 2.7.3 on Linux 64-bit machine. I wanted to fetch frames from my Logitech C270 and store it as an AVI video. The code is working fine, it also shows me the video getting captured and the output file is also created. But when i try to play the file it is not playing at all as well as i am getting 'cv2.VideoWriter object has no attribute release' error on terminal. So, if someone can tell me how to release the cv2.VideoWriter after completion.</p>
  
  <pre><code>import numpy as np
  import cv2
  
  cap = cv2.VideoCapture(1)
  
  fourcc = cv2.cv.CV_FOURCC('X','V','I','D')
  out = cv2.VideoWriter('output.avi', fourcc, 20.0,(640,480))
  
  while(True):
      ret, frame = cap.read()
      if cap.isOpened() == 0:
          cap.open(1)
  
      if ret==True:
  
          gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
          out.write(gray)
          cv2.imshow('frame',gray)
  
          if cv2.waitKey(1) &amp; 0xFF == ord('q'):
              break
  
      else:
          break
  
  cap.release()
  out.release()
  cv2.destroyAllWindows()
  </code></pre>