I don't know where to post this question because it's half a programming question and half a Linux question, so forgive me.
I'm working on a project using Beaglebone Black and I need to execute a very complex python script automatically after the boot, so I followed this tutorial:
(https://stackoverflow.com/questions/28854705/executing-a-script-on-startup-using-beaglebone-black)
which worked, but the script is executed in the / directory and not in the correct directory, which is /root/pyfingerprint/examples/, so when the program tries to execute things in the examples directory it can't find them.
I tried adding a complete path for every line of code which required it and it worked for some parts of the project but it's not enough for cv2 and other libraries.
I tried to solve the problem simply adding os.system("cd /root/pyfingerprint/examples/") at the beginning of the python script but when the program execute on boot it says that the current directory is still /
The program works perfectly when executed manually but not on boot time.
Is there a way to set the working directory of the service to automatically execute it in the right directory?