Unable to load web Settings


I’m hoping this is a simple solution as I can’t seem to figure it out. I’ve made some adjustments to the settings via cli and now the settings webpage no longer loads with an error. I’ve been using it for a little while now and I’ve modified the root password via cli so unsure why it’s showing the error as below:

2019-11-18 11:50:01,459 - ERROR Uncaught exception GET /settings/ (
HTTPServerRequest(protocol=‘http’, host=‘’, method=‘GET’, uri=’/settings/’, version=‘HTTP/1.1’, remote_ip=‘’, headers={‘Accept-Language’: ‘en-au’, ‘Accept-Encoding’: ‘gzip, deflate’, ‘Host’: ‘’, ‘Accept’: ‘text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8’, ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15’, ‘Connection’: ‘keep-alive’, ‘Referer’: ‘’, ‘Upgrade-Insecure-Requests’: ‘1’})
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/tornado/web.py”, line 1467, in _execute
result = method(*self.path_args, **self.path_kwargs)
File “/usr/local/lib/python2.7/dist-packages/mopidy_websettings/init.py”, line 92, in get
‘change_root_password’: can_change_root_password(iniconfig)
UnboundLocalError: local variable ‘iniconfig’ referenced before assignment
2019-11-18 11:50:01,472 - ERROR 500 GET /settings/ ( 546.95ms
2019-11-18 11:50:10,322 - WARNING Element doesn’t implement handling of this stream. Please file a bug.

Here’s my /etc/mopidy/mopidy.conf file (removing wifi creds and links):

root@MusicBoxH:~# cat /etc/mopidy/mopidy.conf


Pi MusicBox / Mopidy Settings


Edit the settings of your MusicBox and the Mopidy music server here

This is a file read by both the MusicBox startup-scripts and Mopidy.

For more info on the settings of Mopidy

or the particular extenion’s GitHub page

Every line starting with a # is a comment, it does not do anything until you remove the


| Network Settings |



Settings for your WiFi network, if you use a (supported) wifi-dongle

Only supports WPA security, no WEP or access points without security (dive into the command line for that!)

wifi_network =

wifi_password =

Optionally set the wifi region for correct regulatory configuration (available channels etc.)

Use the ISO / IEC 3166 alpha2 country code, e.g. wifi_country = GB

wifi_country = AU

Set the name of the MusicBox.

In this way you can identify and access different devices on the same network e.g. across different rooms.

A MusicBox device named kitchen would be accessible from a web browser at , from an MPD

client at kitchen.local and advertised as kitchen on AirTunes.

The name is restricted to a maximum of 9 alphanumeric characters (no spaces, dots, etc).

You can even have different devices with different Spotify accounts when needed.

name = MusicBoxH

Mount Windows Network Drive on boot (via samba/cifs)

The address is exactly how Samba mount works: //servername/mountpoint/directory


if the mount needs a username/password, also set it (leave empty for guest-access)

Additional comma-separated mount options can also be specified.

Don’t forget to let Mopidy/MusicBox scan the contents at first boot (see below)

mount_address = “”

mount_user = “”

mount_password = “”

mount_options = vers=1.0

Here you can change the default workgroup of the Windows network.

This will set the workgroup to the name you want

workgroup = WORKGROUP

Enable this to allow remote login via SSH on MusicBox

enable_ssh = true

Enable this to block network connections on ports other than those explicitly

required by Musicbox. This may prevent any additional network programs from working correctly.

This should be enabled alongside other security hardening methods if

using Musicbox outside of your LAN (not recommended).

enable_firewall = false

By default, MusicBox waits for the network to come up, since there is not much to do without a network.

If you want to skip this, e.g. for testing purposes, uncomment this line

wait_for_network = true


| Spotify |



Supply your PREMIUM account credentials to enable Spotify

enabled = false

username = “”

password = “”

ALSO supply your credentials obtained from

client_id = “”

client_secret = “”

The bitrate, the quality of the music played by Spotify, can be set to 96, 160 (default) or 320

bitrate = 320

cache_dir = “”


| Spotify-Web |


Supply same client credentials as Spotify above


enabled = false

client_id = “”

client_secret = “”


| Last.fm |


Supply your credentials to scrobble tracks to Last.fm


enabled = false

username = “”

password = “”


| SoundCloud |


Supply your auth_token obtained from


enabled = false

auth_token = “”


| Google Music |


Supply your credentials to enable Google Music

NOTE: If enabled this may slow down the start of MusicBox. Please be patient


enabled = false

username = “”

password = “”

deviceid = “”


| YouTube |


Play music from Youtube

NOTE: Search is currently broken!


enabled = true


| Dirble |


Play radio stations from Dirble


enabled = false

api_key = 473279e3fa0e7010cbbbb40ecc31890d46e57a2e

countries = US, NL, DE, NO, SE


| TuneIn Radio |


Play radio stations from TuneIn


enabled = true


| The Internet Archive |


Listen to sounds and music from the Internet Archive


enabled = true


| Soma FM |


Play radio stations from Soma FM


enabled = true

encoding = mp3

quality = fast


| Podcast |


Browse podcasts distributed as RSS feeds and play individual episodes in a variety of audio formats

Edit the subscription file at /boot/config/Podcasts.opml


enabled = true

WARNING: Do not add settings for [podcast-itunes]

because it breaks the startup script (won’t read dashes in section names)


| AudioAddict |


Play music from all the AudioAddict network of sites (login optional)


enabled = true

quality = 40k

difm = true

radiotunes = true

rockradio = true

jazzradio = true

frescaradio = true


| Tidal |


Supply your credentials to enable Tidal.


enabled = false

username = “”

password = “”

Can be set to LOW, HIGH or LOSSLESS. LOSSLESS requires a Tidal HiFi Subscription

quality = HIGH


| MusicBox Settings |



To secure your device, change the default password to something else.

For security, the value below will be automatically cleared once the password is changed.

root_password = “”

Automatically resize the filesystem and use all available space on your SD card.

Use at your own risk, you could lose data on your card.

(If so, you can put the original MusicBox image on it again and start over)

resize_once = false

Scan on startup for new music files on the SD card or the network shares (could take a while!).

Local files work ok for moderate size collections. Large music database sizes could cause problems.

IMPORTANT: if you enable scan_always this will scan on every boot.

If your music doesn’t change or you only stream music set scan_once instead.

scan_once = true

scan_always = false

MusicBox can automatically start playing a stream/song after startup.

It will wait up to autoplaymaxwait seconds before trying to do so for the system to first become ready.

The wait required varies per device, network and configuration so if it doesn’t work then increase the time.

e.g. autoplay = or local:track:MusicBox/Music%20File.mp3 (on the SD Card)

autoplay = anything goes

autoplaymaxwait = 60



| Webclient |


Here you can change the default webclient from musicbox_webclient to something else.

Options: musicbox_webclient, moped, mobile, mopify, simple-webclient, kuechenradio

webclient = musicbox_webclient

Monitor playback to automatically restart internet streams following connectivity issues.

enable_mpd_watchdog = “”


| Streaming |


Set these options to enable streaming to Pi MusicBox

AirTunes (using Shairport-sync):

enable_shairport = false

DLNA/uPnP/OpenHome (using upmpdcli):

enable_upnp = false

Spotify Connect support (using librespot) ** BETA**

enable_connect = false


| Audio Settings |


Because of limitations with some USB-DACs, MusicBox downsamples USB sound to 44k by default. Set to false to disable.

downsample_usb = true

Set default system audio output. This overrides the automatic detection (which sets to usb audio if a usb audio device

is found, else to hdmi (if hdmi is connected at boot), and otherwise just to the analog out).

i2s cards (e.g. HifiBerry etc) are not detected automatically and must be explicitly set here.

Options: analog, hdmi, usb, hifiberry_dac, hifiberry_digi, hifiberry_dacplus, hifiberry_amp, justboom_dac, justboom_digi,

iqaudio_dacplus, iqaudio_digi_wm8804_audio, audioinjector-wm8731-audio, audioinjector-addons,

allo-boss-dac, allo-piano-dac, allo-piano-dac-plus, allo_digione

If you don’t know what to put here then use websettings instead.

output = justboom_dac

enable_stream_watchdog = false

scan_always = true


| OTHER Settings |

| You probably don’t want to edit the settings below this line. Really. |

| Unless you know what you’re doing. |



This is Mopidy’s audio volume. Other applications do not use this.

mixer_volume = 3

This sets the gstreamer buffer. It’s a bit tricky…

If you have problems with stuttering sound, try other values here, like:

#output = alsasink buffer-time=300000 latency-time=20000

#output = alsasink buffer-time=200000 latency-time=10000

output = alsasink

mixer = software

Optionally, you can use alsamixer to enable your usb/audiocard hardware mixer (if available).

To use this, set the previous setting to ‘mixer = alsamixer’, then enable alsamixer below and

set the appropriate card and contol values.

Run the command ‘amixer scontrols’ from the commandline to list the available controls for your mixer.

See for more details.


enabled = false

card = 1

control = Master


enabled = true


hostname =

#Disable zeroconf

zeroconf = “”

static_dir = /opt/musicbox/webclient


musicbox = true


musicbox = true

config_file = /boot/config/settings.ini


hostname =

#Disable zeroconf

zeroconf = “”


cache_dir = /var/cache/mopidy

config_dir = /etc/mopidy

data_dir = /var/lib/mopidy


config_file = /etc/mopidy/logging.conf

debug_file = /var/log/mopidy/mopidy-debug.log


enabled = true

library = sqlite

media_dir = /music/MusicBox

scan_follow_symlinks = false

excluded_file_extensions = .directory .html, .jpeg, .jpg, .log, .nfo, .png, .txt, .mkv, .avi, .divx, .qt, .htm, .zip, .rar, .gz, .pdf, .exe, .ini, .mid, .db, .m3u, .sfv, .midi

WARNING: Do not add settings for [local-sqlite]

because it breaks the startup script (won’t read dashes in section names)


media_dirs =



follow_symlinks = false


playlists_dir = /music/playlists

Any help truly appreciated!

It’s been a while but I think that’s a bug I fixed. Grab the latest development version with:

pip install -U --no-deps https://github.com/pimusicbox/mopidy-websettings/archive/develop.zip
1 Like

Perfect, looks like it fixed my issues. It also looks like it didn’t like these lines in my config on separate lines, so adjusted as per below (line 338 in config file)

media_dirs = /music/MusicBox|Music /music/Xmas|Xmas

Thanks so much for your help!