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 raised when loading plugin paths #3717

Closed
Victrid opened this issue Aug 4, 2020 · 5 comments
Closed

TypeError raised when loading plugin paths #3717

Victrid opened this issue Aug 4, 2020 · 5 comments
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."

Comments

@Victrid
Copy link

Victrid commented Aug 4, 2020

Problem

Due to #3674, I've installed the latest source version with command pip install https://github.com/beetbox/beets/tarball/master under the FAQ guidance.

but it seems that I've got problem in plugin loading. Every command including beet config crashes.

Running this command in verbose (-vv) mode:

$ beet -vv 
user configuration: /home/victrid/.config/beets/config.yaml
data directory: /home/victrid/.config/beets
plugin paths: 
Traceback (most recent call last):
  File "/usr/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/beets/ui/__init__.py", line 1267, in main
    _raw_main(args)
  File "/usr/lib/python3.8/site-packages/beets/ui/__init__.py", line 1250, in _raw_main
    subcommands, plugins, lib = _setup(options, lib)
  File "/usr/lib/python3.8/site-packages/beets/ui/__init__.py", line 1136, in _setup
    plugins = _load_plugins(config)
  File "/usr/lib/python3.8/site-packages/beets/ui/__init__.py", line 1115, in _load_plugins
    beetsplug.__path__ = paths + beetsplug.__path__
TypeError: can only concatenate list (not "_NamespacePath") to list

Led to this problem:

Every command leads here.

Setup

  • OS: Arch Linux x86_64
  • Python version: Python 3.8.5
  • beets version: 1.5.0 (Installed with pip install https://github.com/beetbox/beets/tarball/master)
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

(Even beet config outputs like this, and this is copied from ~/.config/beets/config.yaml)

directory: ~/Documents/Music
library: ~/Documents/Music/musiclibrary.db
import:
    move: yes
paths:
    default: $album%aunique{}/$disc-$track
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$track $title
    ext:jpg: $albumpath/art
    ext:png: $albumpath/art
@Victrid
Copy link
Author

Victrid commented Aug 4, 2020

After modifying this

beetsplug.__path__ = paths + beetsplug.__path__

to

    beetsplug.__path__ = paths + list(beetsplug.__path__)

It get works again.

However, I have little knowledge with python and I don't use any plugins, so I'm not sure this syntax and explicit type convertion is correct. as _NamespacePath could be a special list, and not like a normal list, it will be renewed in some circumstances.

@sampsyo
Copy link
Member

sampsyo commented Aug 4, 2020

Huh, this is odd. On my machine, which also is running Python 3.8.5, this value has type list:

$ python3 -c 'import beetsplug; print(type(beetsplug.__path__))'
<class 'list'>
$ python3 --version
Python 3.8.5

But it looks like it's doing something quite different on your machine? I am pretty confused about why this is the case, but maybe it can't hurt to add that list wrapper defensively…

@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label Aug 4, 2020
@davidswarbrick
Copy link
Contributor

Also running under Arch, installed beets from git repository (so currently running the master branch), I'm unable to recreate the issue:

~ python
Python 3.8.5 (default, Jul 27 2020, 08:42:51)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import beetsplug
>>> print(type(beetsplug.__path__))
<class 'list'>

beet <command> functions correctly

@wisp3rwind
Copy link
Member

wisp3rwind commented Aug 4, 2020

Related: pypa/setuptools#885 and https://docs.python.org/3/reference/import.html#namespace-packages

However, I don't see right now whether this is something we need to cope with, or a broken installation.

EDIT: Actually, this probably means that beetsplug/__init__.py is missing, such that python treats beetsplug as a PEP 420 namespace package instead of an "old-style" namespace package using extend_path.

@Victrid
Copy link
Author

Victrid commented Aug 4, 2020

Thanks @wisp3rwind, I found that there's another beetsplug folder in the .local library, which might be broken and causing this issue.
After removing the folder now beets functions correctly. Maybe this issue can be closed.

@Victrid Victrid closed this as completed Aug 4, 2020
sampsyo added a commit that referenced this issue Oct 5, 2020
I'm still not sure what causes this problem (or more pertinently, what
makes this problem *not* happen for me and others), but this should work
around it regardless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature."
Projects
None yet
Development

No branches or pull requests

4 participants