Auto start script on raspberry pi3

I have a script on raspberry pi desktop that reads\writes to a text file also on desktop. Everything works when I manually run the script, but when I use systemd to auto start, it runs but won’t read\write to the text file. I am using absolute path for the file. Are there any basic dos and donts for using systemd ?

While I’ve used systemd fairly extensively with Python programs on RPis, at least as framed this question seems to be much more about Linux/systemd and not really about Python, and thus might be better off asked somewhere more focused on those topics.

That being said, regardless of where you post it, if you want anyway to actually be able to provide some useful help that isn’t wild guesses, you’ll need to provide some actual specific information about your problem

  • The full systemctl status your-service-name and journalctl -xe -u your-service-name output from stating your service unit, particularly any error messages.

  • The full contents of the service’s unit file, along with its full file path and whether it’s running as a user or a system service.

  • The Python either the Python script you’re running, if its <100 lines, or (better) a minimal reproducible example that showcases the problem.

Make sure to provide each requested file contents/output within a code block. You can do so with the </> button in the toolbar, or via typing triple backticks above and below the code in question, optionally with the language name (e.g. python) for syntax highlighting, like this:

```
<YOUR CODE HERE>
```

Always check the preview to the right to ensure your code/output looks like mine. If it doesn’t, make sure you’ve followed the above instructions or copy/pasted my code block correctly.

Thanks, and best of luck.

I didn’t stop and think that this isn’t really a python problem, thanks for helping anyway. It turns out I just had the working directory wrong.
Everything works now. :grin:

Happens to the best of us…and me :sweat_smile: