- If your SSH connection rejected by your DigitalOcean droplet simply restart your DigitalOcean droplet using turn on/off button in the droplet's dashboard.
- There is an anomaly. If I run the Python codes from absolute path the OpenCV face detection will not working. So, that I can only run the Python code if I
cd
into the Python code first. Let see these examples of codes in the terminal. The first codes are as follows.
python -B /absolute/path/to/my/python/codes/my_open_cv_codes.py
cd /absolute/path/to/my/python/codes/
python -B my_open_cv_codes.py
- The differences is that the first codes has its face detection not working.
- While the second codes has everything works fine.
- What I suspect is that the path to the cascade is set relatively to the the terminal's active directory.
- Here is the code to my example cascade file for OpenCv face detection.
CASC_PATH = "./cascade-face-front-default.xml"
- From the first code I execute that in my
home
directory. Hence, "./cascade-face-front-default.xml"
will point to "~/cascade-face-front-default.xml"
which is non - existent.
- The second code since I did
cd /absolute/path/to/my/python/codes/
the "./cascade-face-front-default.xml"
will get into the correct file.
- Good thing to learn here are these.
- The Python relative path is from the terminal current working directory and not relative from where the Python script is.
- So it is better to just
cd
rather than using Python with absolute path like python -B /absolute/path/to/my/python/codes/my_open_cv_codes.py
.