Beets: Python 3.7 incompatibility

Created on 5 Jul 2018  路  7Comments  路  Source: beetbox/beets

Problem

After upgrading to the latest stable of Python an AttributeError is thrown due to changes in the regular expression module of python 3.7.

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 432, in tag_album
    _add_candidate(items, candidates, id_info)
  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'

This is related to following changes: https://github.com/python/cpython/pull/1646
From what I saw _pattern_type is replaced by Pattern - see https://github.com/python/cpython/pull/1646/files#diff-daea55f2fca784d9a64ca8f190403904 around Line 267 - 272

Setup

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

My configuration (output of beet config) is:

directory: /Volumes/music/

paths:
    default: $albumartist/$album/%if{$disc == 0 && $totaldisc == 1, 01, $disc} - $track - $title
    comp: Compilations/$album/%if{$disc == 0 && $totaldisc == 1, 01, $disc} - $track - $title

ignore: ['Ringtones', '#recycle', '.*', '*~', 'System Volume Information', 'lost+found', '.m4r']

format_item: ($format) $artist - $album - $track - $title

clutter: ['Thumbs.db', '.DS_Store', '*.m3u', '*.pls', '*.nfo', '*.sfv', '*.jpg', '*.jpeg', '*.png', '*.url', '*.URL', '*.txt', '*.ini']

import:
    copy: no
    write: yes
    move: yes

plugins: [discogs, bandcamp, fetchart, embedart, chroma, zero, scrub, duplicates, missing, edit, lastgenre, ftintitle]

bandcamp:
    art: yes

fetchart:
    cautious: yes
    minwidth: 200
    maxwidth: 200
    enforce_ratio: yes
    sources: [filesystem, bandcamp, coverart, amazon, albumart, wikipedia, google]

zero:
    fields: comments
    update_database: yes

lastgenre:
    source: album
    count: 5
    force: yes
    canonical: '~/Documents/git/india.kimpenhaus.home/beets/genres-tree.yaml'
    whitelist: '~/Documents/git/india.kimpenhaus.home/beets/genres.txt'
    prefer_specific: yes
    min_weight: 0
    fallback: ''
    separator: ';'

missing:
    format: $albumartist - $album - $title
    count: no
    total: no

edit:
    itemfields: [track, title, artist, albumartist, album, genre]

ftintitle:
    auto: yes
    drop: no
    format: feat. {0}
bug

Most helpful comment

Oh, yes. Funny, how I overlooked that FAQ entry. You're helpful as ever. Thanks so much.

All 7 comments

Oh dear; that's alarming! Thanks for pointing this out.

It looks like we'll need a fix like this:
https://github.com/getsentry/responses/pull/196/files

Adrian, I'm having this issue too. How should I upgrade beets to apply your fix?

Yo! I should release it very soon, but in the mean time there's an FAQ about that:
http://docs.beets.io/en/v1.4.7/faq.html#run-the-latest-source-version-of-beets

Oh, yes. Funny, how I overlooked that FAQ entry. You're helpful as ever. Thanks so much.

Perdon me, but I installed beets some days ago and the problem still persists.

Hasn't the fix been pushed to the release yet? Do I need to get the code from git?

Hasn't the fix been pushed to the release yet

No.

Do I need to get the code from git?

Yes.

thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Moonbase59 picture Moonbase59  路  4Comments

cgtobi picture cgtobi  路  3Comments

ItsKonix picture ItsKonix  路  4Comments

bammerlaan picture bammerlaan  路  4Comments

nopoz picture nopoz  路  4Comments