I am using the inbuilt cascade classifier for the face detection. This is how the code is (OpenCV Python Tutorials):
import numpy as np
import cv2
face_casc
Well If you are getting this error then you need to download those 2 .xml files, because python can't find them on pc. I had same problem, then I downloaded the .xml files and kept it in folder where my .py file is. and then I got the perfect output. For downloading the files, search the file name and download it from sourceforge.