Newbie here who'd appreciate a bit of help!
I'm trying to get my pi to recognize button inputs from the gpios and launch programs with them. To do so, I wrote a button reading program A which triggers program B with subprocess.Popen upon sensing an input. It worked well, but I wanted it to run automatically upon booting up the pi, so I made a .service file to trigger program A and configured it appropriately to run at launch.
My difficulty is that the program seems to break when called by the service. It seems as though the program is run in the background and in a different means than when called directly from the command line, and program B becomes unable to reach its dependencies. Has anyone had similar problems? Are there any easy ways around this? Can I get the .service to call the function more like a basic command line prompt would? Are there better means than service files to run programs automatically at start up? Regarding the dependencies for program B, should I be importing them in the .service file or in program A in order to get them to load correctly?
I'm trying to get my pi to recognize button inputs from the gpios and launch programs with them. To do so, I wrote a button reading program A which triggers program B with subprocess.Popen upon sensing an input. It worked well, but I wanted it to run automatically upon booting up the pi, so I made a .service file to trigger program A and configured it appropriately to run at launch.
My difficulty is that the program seems to break when called by the service. It seems as though the program is run in the background and in a different means than when called directly from the command line, and program B becomes unable to reach its dependencies. Has anyone had similar problems? Are there any easy ways around this? Can I get the .service to call the function more like a basic command line prompt would? Are there better means than service files to run programs automatically at start up? Regarding the dependencies for program B, should I be importing them in the .service file or in program A in order to get them to load correctly?
Statistics: Posted by Almaniacal — Sat Nov 09, 2024 9:00 am