Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'ProviderConfiguration' object is not a mapping when adding new music source #320

Closed
sumnerevans opened this issue Sep 15, 2021 · 10 comments
Labels
bug Something isn't working gl-import This issue was imported from GitLab

Comments

@sumnerevans
Copy link
Member

In GitLab by @fuomag9 on Sep 15, 2021, 03:57

Adding a new music source fails with the stack trace below. I'm using python3.9 and I installed sublime music via pip

(sublime-music:48152): Gtk-CRITICAL **: 11:54:04.837: gtk_widget_set_size_request: assertion 'width >= -1' failed

(sublime-music:48152): Gtk-CRITICAL **: 11:54:06.074: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:48152): Gtk-CRITICAL **: 11:54:06.075: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:48152): Gtk-CRITICAL **: 11:54:06.075: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:48152): Gtk-CRITICAL **: 11:54:06.075: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:48152): Gtk-CRITICAL **: 11:54:06.075: gtk_entry_set_text: assertion 'text != NULL' failed
Traceback (most recent call last):
  File "/home/fuomag9/.local/lib/python3.9/site-packages/sublime_music/app.py", line 167, in do_activate
    self.show_configure_servers_dialog()
  File "/home/fuomag9/.local/lib/python3.9/site-packages/sublime_music/app.py", line 1019, in show_configure_servers_dialog
    self.app_config.save()
  File "/home/fuomag9/.local/lib/python3.9/site-packages/sublime_music/config.py", line 234, in save
    json = self.to_json(indent=2, sort_keys=True)
  File "/home/fuomag9/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 49, in to_json
    return json.dumps(self.to_dict(encode_json=False),
  File "/home/fuomag9/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 85, in to_dict
    return _asdict(self, encode_json=encode_json)
  File "/home/fuomag9/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 346, in _asdict
    return _encode_overrides(dict(result), _user_overrides_or_exts(obj),
  File "/home/fuomag9/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 110, in _encode_overrides
    v = encoder(v) if encoder is not None else v
  File "/home/fuomag9/.local/lib/python3.9/site-packages/sublime_music/config.py", line 71, in encode_providers
    return {
  File "/home/fuomag9/.local/lib/python3.9/site-packages/sublime_music/config.py", line 72, in <dictcomp>
    id_: {
TypeError: 'ProviderConfiguration' object is not a mapping
@sumnerevans
Copy link
Member Author

In GitLab by @LennyPenny on Sep 19, 2021, 12:43

I can confirm this, getting the same error

Fedora 34

@sumnerevans
Copy link
Member Author

In GitLab by @user-resu on Sep 20, 2021, 14:11

I can confirm it as well.
Installed it on Fedora 34 with pip install --user sublime-music[keyring].

(sublime-music:282029): Gtk-CRITICAL **: 22:03:24.171: gtk_widget_set_size_request: assertion 'width >= -1' failed

(sublime-music:282029): Gtk-CRITICAL **: 22:03:28.158: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:282029): Gtk-CRITICAL **: 22:03:28.159: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:282029): Gtk-CRITICAL **: 22:03:28.161: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:282029): Gtk-CRITICAL **: 22:03:28.165: gtk_entry_set_text: assertion 'text != NULL' failed

(sublime-music:282029): Gtk-CRITICAL **: 22:03:28.166: gtk_entry_set_text: assertion 'text != NULL' failed
2021-09-20 22:04:09,111:WARNING:root:adapter:Salted auth not supported, falling back to regular password auth
Traceback (most recent call last):
  File "/home/uros/.local/lib/python3.9/site-packages/sublime_music/app.py", line 167, in do_activate
    self.show_configure_servers_dialog()
  File "/home/uros/.local/lib/python3.9/site-packages/sublime_music/app.py", line 1019, in show_configure_servers_dialog
    self.app_config.save()
  File "/home/uros/.local/lib/python3.9/site-packages/sublime_music/config.py", line 234, in save
    json = self.to_json(indent=2, sort_keys=True)
  File "/home/uros/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 49, in to_json
    return json.dumps(self.to_dict(encode_json=False),
  File "/home/uros/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 85, in to_dict
    return _asdict(self, encode_json=encode_json)
  File "/home/uros/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 346, in _asdict
    return _encode_overrides(dict(result), _user_overrides_or_exts(obj),
  File "/home/uros/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 110, in _encode_overrides
    v = encoder(v) if encoder is not None else v
  File "/home/uros/.local/lib/python3.9/site-packages/sublime_music/config.py", line 71, in encode_providers
    return {
  File "/home/uros/.local/lib/python3.9/site-packages/sublime_music/config.py", line 72, in <dictcomp>
    id_: {
TypeError: 'ProviderConfiguration' object is not a mapping

@sumnerevans
Copy link
Member Author

In GitLab by @user-resu on Sep 23, 2021, 13:10

If it makes any difference - I'm trying to add NextCloud music: https://<nextcloud.server.url>/index.php/apps/music/subsonic

@sumnerevans
Copy link
Member Author

In GitLab by @dominikh1 on Sep 25, 2021, 03:14

I believe the same issue is cause of this test failure (when trying to build the sublime-music derivation in nixpkgs):

=================================== FAILURES ===================================
____________________________ test_json_load_unload _____________________________

config_filename = PosixPath('/build/pytest-of-nixbld/pytest-0/test_json_load_unload0/config.json')
tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_json_load_unload0')

    def test_json_load_unload(config_filename: Path, tmp_path: Path):
        ConfigurationStore.MOCK = True
        subsonic_config_store = ConfigurationStore(username="test")
        subsonic_config_store.set_secret("password", "testpass")
        original_config = AppConfiguration(
            providers={
                "1": ProviderConfiguration(
                    id="1",
                    name="foo",
                    ground_truth_adapter_type=SubsonicAdapter,
                    ground_truth_adapter_config=subsonic_config_store,
                    caching_adapter_type=FilesystemAdapter,
                    caching_adapter_config=ConfigurationStore(),
                )
            },
            current_provider_id="1",
            filename=config_filename,
        )
        original_config.cache_location = tmp_path

>       original_config.save()

tests/config_test.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sublime_music/config.py:234: in save
    json = self.to_json(indent=2, sort_keys=True)
/nix/store/gcjrlacw2hvvbik7ybrq2wga17pl0dc2-python3.9-dataclasses-json-0.5.6/lib/python3.9/site-packages/dataclasses_json/api.py:49: in to_json
    return json.dumps(self.to_dict(encode_json=False),
/nix/store/gcjrlacw2hvvbik7ybrq2wga17pl0dc2-python3.9-dataclasses-json-0.5.6/lib/python3.9/site-packages/dataclasses_json/api.py:85: in to_dict
    return _asdict(self, encode_json=encode_json)
/nix/store/gcjrlacw2hvvbik7ybrq2wga17pl0dc2-python3.9-dataclasses-json-0.5.6/lib/python3.9/site-packages/dataclasses_json/core.py:346: in _asdict
    return _encode_overrides(dict(result), _user_overrides_or_exts(obj),
/nix/store/gcjrlacw2hvvbik7ybrq2wga17pl0dc2-python3.9-dataclasses-json-0.5.6/lib/python3.9/site-packages/dataclasses_json/core.py:110: in _encode_overrides
    v = encoder(v) if encoder is not None else v
sublime_music/config.py:71: in encode_providers
    return {
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

.0 = <dict_itemiterator object at 0x7fffea75e0e0>

    return {
>       id_: {
            **config,
            "ground_truth_adapter_type": config["ground_truth_adapter_type"].__name__,
            "caching_adapter_type": (
                cast(type, config.get("caching_adapter_type")).__name__
                if config.get("caching_adapter_type")
                else None
            ),
        }
        for id_, config in providers_dict.items()
    }
E   TypeError: 'ProviderConfiguration' object is not a mapping

sublime_music/config.py:72: TypeError
=========================== short test summary info ============================
FAILED tests/config_test.py::test_json_load_unload - TypeError: 'ProviderConf...
========================= 1 failed, 75 passed in 3.11s =========================

@sumnerevans
Copy link
Member Author

In GitLab by @bigjdunham on Oct 7, 2021, 10:58

I'm also getting this error when installing with pip in Ubuntu 20.04.

@sumnerevans
Copy link
Member Author

In GitLab by @djjudas21 on Oct 8, 2021, 05:06

Also getting this error installing by Pip on Fedora 34

Traceback (most recent call last):
  File "/home/jonathan/.local/lib/python3.9/site-packages/sublime_music/app.py", line 167, in do_activate
    self.show_configure_servers_dialog()
  File "/home/jonathan/.local/lib/python3.9/site-packages/sublime_music/app.py", line 1019, in show_configure_servers_dialog
    self.app_config.save()
  File "/home/jonathan/.local/lib/python3.9/site-packages/sublime_music/config.py", line 234, in save
    json = self.to_json(indent=2, sort_keys=True)
  File "/home/jonathan/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 49, in to_json
    return json.dumps(self.to_dict(encode_json=False),
  File "/home/jonathan/.local/lib/python3.9/site-packages/dataclasses_json/api.py", line 85, in to_dict
    return _asdict(self, encode_json=encode_json)
  File "/home/jonathan/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 346, in _asdict
    return _encode_overrides(dict(result), _user_overrides_or_exts(obj),
  File "/home/jonathan/.local/lib/python3.9/site-packages/dataclasses_json/core.py", line 110, in _encode_overrides
    v = encoder(v) if encoder is not None else v
  File "/home/jonathan/.local/lib/python3.9/site-packages/sublime_music/config.py", line 71, in encode_providers
    return {
  File "/home/jonathan/.local/lib/python3.9/site-packages/sublime_music/config.py", line 72, in <dictcomp>
    id_: {
TypeError: 'ProviderConfiguration' object is not a mapping

Looks like I'm on Python 3.9

[jonathan@poseidon ~]$ pip -V
pip 21.0.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)

@sumnerevans
Copy link
Member Author

In GitLab by @shibacomputer on Oct 12, 2021, 08:34

+1 for this, exact same issue. Fedora 34 with install via Pip!

@sumnerevans
Copy link
Member Author

In GitLab by @djjudas21 on Oct 12, 2021, 09:47

I'm no Python expert but I believe the error we're seeing here is because we're trying to run it on Python 3.9. Issue #317 tracks the upgrade to Python 3.9 and includes a task "convert everything to use the new type annotations" which might be related to this issue? Not sure.

As a workaround, I managed to get Sublime Music running on Fedora 34 by using the Poetry config. You need to check out a Git repo and build with Poetry, with effectively provides a virtualenv with the right version of Python.

# Install Poetry and the deps required to build Sublime Music
sudo dnf install poetry cairo-devel cairo-gobject-devel xorg-x11-proto-devel gobject-introspection-devel
export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"

# Grab the source for Sublime Music
git clone https://gitlab.com/sublime-music/sublime-music.git
cd sublime-music

# Install deps with Poetry
poetry install

# Run Sublime Music
poetry run sublime-music

It's a hack... but at least it allowed me to evaluate Sublime Music for my needs - and I like it. Looking forward to a fixed package :slight_smile:

@sumnerevans
Copy link
Member Author

Should be fixed in !68

@sumnerevans
Copy link
Member Author

marked this issue as related to #327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gl-import This issue was imported from GitLab
Projects
None yet
Development

No branches or pull requests

1 participant