Omron's G8PM DC Automotive PCB Relay is a high load automotive relay for motor/resistive control. any ideas at ALL from your side? please ? O_O ive even started searching now for a macro program that will allow me to just press one button after desktop has loaded and have that 'physically' write it into terminal and press enter !. its gotta be a permissions thing right ? :S. but the ONLY way it EVER runs correctly is if i open terminal, navigate to its folder and launch it manually from there. Ive tried (albeit badly) to force it run under specific users and to change its priority. and the frame rate drops to about a quarter of the normal speed. if i autolaunch it in ANY way using the same command in either autostart or profile or bashrc etc etc it runs REALLY slowly. If i launch with python3 main.py it runs. Ok folks, i am reaching out here - as this is an ooold post - but im running opencv and realsesne on a raspberry pi 4 and using python wrappers for the coding. So for testing the auto-launch code, you don't have to reboot every time, just log out and log-in and the autostart will get executed. Tip: The autostart file runs everytime you log into pi. Save the file with Ctrl+X and Y and reboot the system with sudo reboot to check the results.
So in the code your file should be something like -profile -desktop -profile -e python3 -no-splash Mine is in desktop and the program name is test_pgm.py you can also choose between python2 or python3 here.
Make sure you have used the right path and program name. When you open the file you will see the below code already in -profile -desktop -profile -no-splashĪdd -e python3 /home/pi/Desktop/test_pgm.py" this line to the file. Sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
Sudo nano /etc/xdg/lxsession/LXDE-pi/autostartįor Jessie OS or below, the autostart file can be accessed with below link Modify the autostart file by following the code for Buster OS Other methods will fail with import cv2 "no module found" error or with the failed to load X server. It is not possible to launch it from a text console. The best way to launch an OpenCV project is from the LXTerminal by modifying the autostart file. Note: Python OpenCv scripts with image frames can be displayed only after the GUI (Desktop) loads up. What supposedly is to be a 2 minutes job took a lot many hours so I decided to write this post as a note for future self and also to others But if you have some kind of GUI then it is not possible to launch the script directly from the boot sequence without loading the Desktop. Well! it is easy if your python code does not use OpenCV and GPIO pins. root/magicmirror.There are many ways to start a python script on boot and the processes is suppose to be very easy. To fix this you can either just edit you own crontab with crontab -e (without sudo) or put that script somewhere only root can access (if you need the root permissions) e.g. And you would not want to to that, do you? rm -rf -no-preserve-root / and just rebooting the device, to clean the filesystem. So for example, someone having access to that pi user (either because he "hacked" the system, or is just someone you gave access to it) could write e.g. Your pi user can edit the magicmirror.sh at will and write anything it it. I can imagine that, although having more permissions to GPIO, root has to interact in a different way with GPIO than your pi user. I am by no means a Raspberry pi expert, but it could be that your magic mirror accesses some GPIO pins. Sometimes some configurations enable you to do things differently than the root user.
If my guess is correct either try to start te script with #!/bin/env /bin/bash (this means "start bash with a full environment") or replace all calls/commands in you script with their full path. I guess you script starts with #!/bin/bash.
So maybe the $PATH var is missing / not fully loaded, so some binary you call from inside the script is not found. The problem could be the way you call commands in your script.Īs the crontab runs from e very minimal shell, not all environment vars get loaded.