Audio Amp SHIM error: "version of mpg321 has been configured with the libao default"

Any assistance would be most welcome. Having spent a couple of days on this I am at a bit of a loss what to try next.

Hardware is a Raspberry Pi Zero W with a Pimoroni Audio Amp SHIM

I installed the software as suggested

git clone https://github.com/pimoroni/pirate-audio
cd pirate-audio/mopidy
sudo ./install.sh

I can run the following from the command line and the song plays fine through the speaker attached to the SHIM output.

mpg321 -g 20 /home/pi/Music/test.mp3

But when I try this test script -

from mpyg321.mpyg321 import MPyg321Player
player=MPyg321Player()
track="/home/pi/Music/test.mp3"
player.play_song(track)
  • it plays nothing and outputs the error messages below.

The output when I run the above test04.py

pi@SoundPiZero:~/mpwmusic $ python3 test04.py
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
    s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
    raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/mpyg321/mpyg321.py", line 202, in process_output
    index = self.player.expect(mpg_codes)
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0xb6685b70>
command: /usr/bin/mpg123
args: ['/usr/bin/mpg123', '--remote']

buffer (last 100 chars): b''
before (last 100 chars): b' version of mpg321 has been configured with the libao default as its default\r\nlibao output device.\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 0
flag_eof: True
pid: 19787
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'@P 0')
    1: re.compile(b'@P 1')
    2: re.compile(b'@P 2')
    3: re.compile(b'@P 3')
    4: re.compile(b'@E *')
pi@SoundPiZero:~/mpwmusic $

my config.txt
I did not change anythinng manually. But spot checked those parameters metioned in the mopidy github docs and they look OK to me.
Here is the end of my config.txt. Everything before this is commented out.

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
gpio=25=op,dh
dtoverlay=hifiberry-dac