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

Python 3.7 removes re._pattern_type #2986

Closed
danarnold opened this Issue Jul 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@danarnold
Copy link

danarnold commented Jul 16, 2018

Problem

Python 3.7 no longer has re._pattern_type (see python/cpython#1646), which is used here:

if isinstance(value1, re._pattern_type):

This causes a crash on import:

Traceback (most recent call last):
  File "/usr/local/bin/beet", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/beets/ui/__init__.py", line 1256, in main
    _raw_main(args)
  File "/usr/local/lib/python3.7/site-packages/beets/ui/__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python3.7/site-packages/beets/ui/commands.py", line 943, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python3.7/site-packages/beets/ui/commands.py", line 913, in import_files
    session.run()
  File "/usr/local/lib/python3.7/site-packages/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python3.7/site-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python3.7/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python3.7/site-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python3.7/site-packages/beets/importer.py", line 1351, in lookup_candidates
    task.lookup_candidates()
  File "/usr/local/lib/python3.7/site-packages/beets/importer.py", line 641, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/match.py", line 461, in tag_album
    _add_candidate(items, candidates, matched_candidate)
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/match.py", line 377, in _add_candidate
    dist = distance(items, info, mapping)
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/match.py", line 191, in distance
    dist.add_equality('media', album_info.media, likelies['media'])
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/hooks.py", line 461, in add_equality
    if self._eq(opt, value):
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/hooks.py", line 436, in _eq
    if isinstance(value1, re._pattern_type):
AttributeError: module 're' has no attribute '_pattern_type'

Solution

The above line just needs to be changed to re.Pattern. I fixed it by editing my local autotag/hooks.py and adding re._pattern_type = re.Pattern right after import re.

Setup

  • OS: MacOS 10.13.5
  • Python version: 3.7.0
  • beets version: 1.4.7
  • Turning off plugins made problem go away (yes/no): no.

My configuration (output of beet config) is:

directory: ~/mus
library: ~/.config/beets/library.db

import:
    move: yes
    detail: yes
@sampsyo

This comment has been minimized.

Copy link
Member

sampsyo commented Jul 16, 2018

Please see #2978.

@sampsyo sampsyo closed this Jul 16, 2018

@sampsyo sampsyo added the duplicate label Jul 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment