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

danarnold opened this Issue Jul 16, 2018 · 1 comment


None yet
2 participants
Copy link

danarnold commented Jul 16, 2018


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>
  File "/usr/local/lib/python3.7/site-packages/beets/ui/", line 1256, in main
  File "/usr/local/lib/python3.7/site-packages/beets/ui/", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python3.7/site-packages/beets/ui/", line 943, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python3.7/site-packages/beets/ui/", line 913, in import_files
  File "/usr/local/lib/python3.7/site-packages/beets/", line 329, in run
  File "/usr/local/lib/python3.7/site-packages/beets/util/", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python3.7/site-packages/", line 693, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/beets/util/", line 312, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python3.7/site-packages/beets/util/", line 194, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python3.7/site-packages/beets/", line 1351, in lookup_candidates
  File "/usr/local/lib/python3.7/site-packages/beets/", 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/", line 461, in tag_album
    _add_candidate(items, candidates, matched_candidate)
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/", line 377, in _add_candidate
    dist = distance(items, info, mapping)
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/", line 191, in distance
    dist.add_equality('media',, likelies['media'])
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/", line 461, in add_equality
    if self._eq(opt, value):
  File "/usr/local/lib/python3.7/site-packages/beets/autotag/", line 436, in _eq
    if isinstance(value1, re._pattern_type):
AttributeError: module 're' has no attribute '_pattern_type'


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


  • 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

    move: yes
    detail: yes

This comment has been minimized.

Copy link

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