I hope this is not a duplicate post however I have spent about 16 hours researching a solution for my problem and have not found it yet. I am attempting to run a python GUI that acts as an interface for a robot communication. The file as well as other necessary files such as .ini files are located in a folder in the /pi directory called "op_interface". The .py executes fine when navigating to the directory and then running the python file as so
sudo python op_interface.py
My goal is for this GUI to start any time that the Pi is rebooted. I have read multiple posts about using crontab, lxterminal on boot using "etc/xdg/lxsession/LXDE-pi/autostart", and many other ways that should work to do this but have been unable to get them to work with mine.
I believe I have narrowed the issue down to none of these methods being able to "locate" the other files that are needed to run my GUI (my GUI calls a couple other .py files to function). For instance when I type
sudo python /home/pi/op_interface/op_interface.py in terminal to try to execute my GUI, I receive an error about it not being able to find the information needed from an .ini file in the same "op_interface" folder.
Because of it not being able to find those files, I believe that cron also does the same thing and I am wondering how I would need to point cron to this entire folder?
I currently have the final line in cron as
@reboot sudo python /home/pi/op_interface/op_interface.py and have tried other variations such as
@reboot sudo usr/bin/python /home/pi/op_interface/op_interface.py and
@reboot sudo usr/bin/python2 /home/pi/op_interface/op_interface.py which did not work either.
I have also placed
#!/usr/bin/env python at the top of the code in my .py file as well and it is still not working.
I am using Raspbian NOOBS V2.4.4 on a R-Pi 3B. If anyone can see what I am doing wrong or knows how to get this working, your advice would be much appreciated. If you would like actual python code samples, I can provide that as well. Thank you.