RPI: How to write python script output to log file with autostart

Viewed 21

How can I log the output from a python script to a file when the script starts automatically at boot?

I have a python program with a tKinter (so an interactive GUI) Therefore I have made a file in the /etc/xdg/autostart folder with the following:

[Desktop Entry]
Name=Visual_assistant
Exec=sudo /usr/bin/python3 /home/pi/Documents/va.py &>> /home/pi/logs/va.txt

However, the log file never gets created. Any suggestions to solve this? Or should I do it in a different way? Note: I'm sure about the paths - tested this by running the python script via CLI

Many thanks for any help

0 Answers
Related