pygame or pygame2?
AIUI pygame2 (or is it versions >= 2? I'm not sure as I don't use it much) needs the desktop to be running in order to do anything graphical but I don't know if that also applies when doing audio.
You need to share your service file and full details of the other methods you have tried.
Next question: when you said "I can execute the script on the CLI" was that in a pure command line environment or in a terminal on the desktop? Or over ssh/vnc?
When running automatically are you running it as the same user as when running it from the command line?
I know I don't cover audio but have you worked through the rest of my troubleshooting advice?
One hackish approach goes like this:
The documentation for pygame may also help resolve things.
Personally, I'd find a way to play the audio that doesn't depend on the GUI/X11 and pygame.
Lastly, when you post code (especially python code) you need to wrap it in code tags. If you don't all indentation is lost when your post is viewed. Indentation matters in python so while we can see where your while loop starts we cannot see with certainty where it ends.
AIUI pygame2 (or is it versions >= 2? I'm not sure as I don't use it much) needs the desktop to be running in order to do anything graphical but I don't know if that also applies when doing audio.
You need to share your service file and full details of the other methods you have tried.
Next question: when you said "I can execute the script on the CLI" was that in a pure command line environment or in a terminal on the desktop? Or over ssh/vnc?
When running automatically are you running it as the same user as when running it from the command line?
I know I don't cover audio but have you worked through the rest of my troubleshooting advice?
One hackish approach goes like this:
- Boot to command line, log in and try to run your program using the exact same command as in your chosen autostart method and from teh same pwd that that method would use.
- Assuming the code works, run
Code:
echo $XDG_RUNTIME_DIR
- Modify your start mechanism so that it sets XDG_RUNTIME_DIR to the same value before running your code. Exact details depend on the method you're using.
The documentation for pygame may also help resolve things.
Personally, I'd find a way to play the audio that doesn't depend on the GUI/X11 and pygame.
Lastly, when you post code (especially python code) you need to wrap it in code tags. If you don't all indentation is lost when your post is viewed. Indentation matters in python so while we can see where your while loop starts we cannot see with certainty where it ends.
Statistics: Posted by thagrol — Fri Nov 01, 2024 1:21 am