sbarakat/beets-copyartifacts

copyartifacts stops copying when it throws exception

jojojames opened this issue · 9 comments

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\plugins.py", line 124, in wrapper
    return func(*args, **kwargs)
TypeError: process_events() got an unexpected keyword argument 'lib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.4.5', 'console_scripts', 'beet')()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\ui\__init__.py", line 1256, in main
    _raw_main(args)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\ui\__init__.py", line 1245, in _raw_main
    plugins.send('cli_exit', lib=lib)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\plugins.py", line 452, in send
    result = handler(**arguments)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\plugins.py", line 130, in wrapper
    return func(*args, **kwargs)
  File "c:\program files (x86)\python36-32\lib\site-packages\beets_copyartifacts-0.1.2-py3.6.egg\beetsplug\copyartifacts.py", line 127, in process_events
  File "c:\program files (x86)\python36-32\lib\site-packages\beets_copyartifacts-0.1.2-py3.6.egg\beetsplug\copyartifacts.py", line 161, in process_artifacts
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\beets\util\__init__.py", line 536, in unique_path
    match = re.search(br'\.(\d)+$', base)
  File "C:\Program Files (x86)\Python36-32\lib\re.py", line 182, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a bytes pattern on a string-like object
PS C:\Users\james>

Duplicate of #31

@thomwiggers Are you sure it's a dup? The last comment indicates the development version works.

I believe I cloned the repo to get copyartifacts.

"TypeError: cannot use a bytes pattern on a string-like object" is a typical "trying to use python 2 code under python 3"-problem. Clearly Python 3 still isn't fully supported.

This could be something missed in the test coverage in the development version.

@jojojames, could you paste your copyartifacts config?

copyartifacts:
extensions: .*
print_ignored: yes

https://github.com/jojojames/beets/blob/master/config.yaml

The main problem is that the process_events method does not support the lib kwargs of cli_exit. That kwarg has been added in 2013 by this commit: beetbox/beets@2ad5b4c
A fix should be trivial.

I just triggered this bug when updating a massive library. It was quite annoying since all the music files were moved but all the artifacts were left in the original folders, requiring manual movement. Maybe #43 could be merged easily, since it's a one-word fix.

I had the same issue with my recent massive library update.

Is this ever going to be fixed? I've had to deal with this problem numerous times because I've had to reinstall multiple versions of Python, and the buggy version is installed from pip every time. I would gladly volunteer to merge the patches if it were possible.