Added this to the "/etc/rc.local" just before the exit 0 at the end.
Code: Select all
sudo python3 /home/pi/max7219/examples/VPsong-19.py & > /home/pi/Desktop/log.txt 2>%1
How do I get it to run.
Code: Select all
sudo python3 /home/pi/max7219/examples/VPsong-19.py & > /home/pi/Desktop/log.txt 2>%1
Code: Select all
python3 /home/pi/max7219/examples/VPsong-19.py >> /home/pi/Desktop/log.txt 2>&1 &
Since your code requires GUI (tkinter) you can not use rc.local to start it as the code is executed before the GUI has started.Daveolw1 wrote: ↑Fri Dec 13, 2019 10:25 pmHi,
Many thanks for your reply.
With your code, something is happening now, the log text state error "no such file or directory", the files are on a separate USB stick and the program runs OK from the Python editor. The directory for the usb is "media/pi/storage/xxxx.txt".
Can it not access this at that stage?
The program use tinker and displays a window with text, push buttons to GPIO pins and seven segment led.
Thanks David
Code: Select all
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Probably not. Unless you've added an fstab entry or systemd mount unit for the USB stick yourself it won't get mounted until after the desktop starts.Daveolw1 wrote: ↑Fri Dec 13, 2019 10:25 pmWith your code, something is happening now, the log text state error "no such file or directory", the files are on a separate USB stick and the program runs OK from the Python editor. The directory for the usb is "media/pi/storage/xxxx.txt".
Can it not access this at that stage?
Code: Select all
@lxterminal --command sudo python3 /home/pi/max7219/examples/VPsong-10.py
It sounds like something is wrong with the Python program. Are you sure it is fully debugged?
And sometimes it doesn't. Are you sure it is fully debugged?Sometimes it loads correctly.
Suggestion: Install xterm (sudo apt-get install xterm) and then use the "-hold" option.Is there any way to read what is on the LXterminal?
Or redirct stdout and stderr to a file when running your program, For example:GlowInTheDark wrote: ↑Sat Dec 14, 2019 9:39 pmSuggestion: Install xterm (sudo apt-get install xterm) and then use the "-hold" option.
Code: Select all
@lxterminal --command sudo python3 /home/pi/max7219/examples/VPsong-10.py >/home/pi/max7219/examples/VPsong-10.log 2>&1
Code: Select all
bash -c 'myprogram.py;read -p "Press enter to continue..."'
Code: Select all
@lxterminal -e python3 /home/pi/your_script.py
Code: Select all
@lxterminal --command sudo python3 /home/pi/max7219/examples/VPsong-19.py >/home/pi/Desktop/log.txt 2>&1
Code: Select all
@lxterminal --command bash -c '/home/pi/max7219/examples/VPsong-19.py;read -p "Press enter to continue..."'
I don't why this error occurs because it runs ok when I type in the xterm direct.Traceback (most recent call last):
File "/home/pi/max7219/examples/VPsong-19.py", line 37, in <module>
root = Tk()
File "/usr/lib/python3.5/tkinter/__init__.py", line 1880, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable