Sorry for the scattershot replies, I've tried to condense them.Could be anything.
Add some more debug output to your code. Send that to a log file.
Some suggestions:Generally speaking, .bashrc is almost always the wrong option for starting something that needs a logged in desktop. Even if it doesn't, it's likely the wrong choice in this case anyway. It runs on every login regardless of source so will (try to) start multiple copies of your application. if there is no login, it won't run and your application won't be started.
- Try the SD card from the 4B in the zero2W. Does it work as expected or do you see the same behaviour?
- Tell us whether your application requires a running desktop
- Try with a different desktop backend.
- Plug in a monitor. See if your application is launching on that.
- Tell us which OS you're using on the zero2w and which named release of it.
- Tell us which OS you're using on the 4B and which named release of it
- Tell us which changes you've made from the defaults on both OS/Pi.
- Tell us more about your application.
- Tell us exactly what you have put into your .bashrc
- Tell us more about "The script runs fine when manually launched via terminal on the Zero 2W". Was that over ssh, from a command line only boot, from a terminal window inside the desktop? What command(s) di you use to launch it?
- Tell us what the differences are (apart from Pi model) between the zero2W and the 4B
While .bashrc is run when logging in to the desktop that happens before the desktop is fully available so will likely fail to start.
Almost anything requiring the desktop is going to perform poorly on a zero2w due to its limited RAM. Boosting swap may make things more stable but probably won't help much with performance.
1.) SWAP SD: Swapping out the SD for the existing 4B one, and that one runs, although on the zero2W it takes a few seconds more to get to the main menu of the window than on the 4B.
The 4B SD is relatively fresh as well, though not as fresh as the zero2W; it's possible there's some sort of alteration I performed, but I don't have anything related to this in my notes, history, or personal memory.
2.) DESKTOP APPLICATION: I'm novice enough to not know what makes this a desktop application or not. The general details:
- The application is a wireless swordfighting game, using 2 Pis to communicate over WiFi to share GPIO information, and communicating via a TCP/IP Server and Client structure.
- The pygame elements are used to display a start menu (Start, Join, Settings, Quit), and display simple gamestate details during and after the game
- The only additional libraries on either 4B or zero2W SDs have been the ones for enabling the 2.2" non-touch display, Blinka, and neopixel.
Does 'desktop application' just mean that this requires logging in and making it to the desktop screen? Would I be able to run this without needing a log-in, and if so, are there any guides/tutorials you can point me at for this?
3.) VERSION: I'm using Bookworm for both versions, unless your question of version is more specific than this.
4.) MONITOR: I also tried this with just a separate monitor connected by HDMI, it still wasn't showing the pygame window. But it did look like the display was still setup with 2 displays (the 2.2" and the HDMI monitor, with the 2.2" as the primary.)
5.) BASH COMMANDS: The commands in the .bashrc file are:
Code:
sleep 30source /home/sz1/env/bin/activatesudo -E env PATH=$PATH python3 /home/sz1/git/ST/main.py --rpi=1I had tried other methods of setting this application to run on boot, but using .bashrc was the first one that worked. I definitely don't want to keep using this for the final product, which other method would you recommend as the most reliable?
Statistics: Posted by GogglesGreek — Thu Dec 04, 2025 8:26 pm