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
Maybe, you use virtualenv for python like me. You try this.
import os
base_directory = os.path.abspath(os.getcwd())
directory_cv2 = os.path.join(base_directory, "Lib", "site-packages", "cv2","data")
print("la carpeta es: {}".format(directory_cv2))
I faced the same problem. First you will have to give the correct path of the file to the system, which looks like this: /home/xxxx/Desktop/Projects/haarcascade_eye.xml. Next, you'll have to open the code on github and save the raw version of the code for it run. It's advisable for both the files to be in the folder where you are storing your project file. Happy coding