Pygame Mixer in python script - No available audio device

Using Python3, I am using pygame mixer to play an mp3 using the headphone output. If I run as root or as the dietpi user from the console, the script runs and it plays perfectly. Trying to run the same script from node-red using an "exec" node, I am getting an error that there is No available audio device. I'm assuming the account actually running Node-Red is running the script and it is an access problem. But I am having a hard time finding a thread that relates to this. Thank you!

This might help

I did specify the device in the pymixer init, thinking it might be the case, but that didn't work either and it fails on init before I even get to the file path of the music. Instead of pymixer, I will try your mpg123 approach instead, perhaps different libraries will give a different result. I'll post results.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.