You can change the master volume within the terminal itself by using the command shown underneath.
amixer -D pulse sset Master 5%+
However, when I tried to execute the following code in Python, the following error is shown.
No protocol specified xcb_connection_has_error() returned true ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused amixer: Mixer attach pulse error: Connection refused
And here is the code producing the error above.
os.system("amixer -D pulse sset Master 5%+")
How does one resolve that error?