Ok, so i made a python script places inside a package. The tree looks something like this:
├── foo
│ ├── __init__.py
│ ├── funcs
│ │ ├── __init__.py
│ │ └── stuff.py
│ ├── resources
│ │ └── haarcascade_frontalface_default.xml
│ └── scripts
│ ├── __init__.py
│ └── script.py
└── setup.py
So inside the script file, im using openCV's cv2 to detect faces, and for that the cv2.CascadeClassifier requires the path of the XML file located under /resources. Now because this is a script, i need to be able to run it from anywhere, so a relative path to the resource file sadly doesn't do the trick. How can I get the absolute path to the xml file from within script.py? You can assume that the script and the xml file is located relative to each other respectively, just like the example above. Thanks :))
PS: Bonus if the solution works with eggs as well. Much appreciated