question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MusicBrainz won't connect (SSL: CERTIFICATE_VERIFY_FAILED)

See original GitHub issue

beets won’t connect to MusicBrainz. discogs, fetchart, other things connect, but not this.

Problem

Running this command in verbose (-vv) mode:

beet -vv import /Volumes/Expansion-1/Media/Audio/

Led to this problem:

Searching for MusicBrainz releases with: {'release': '14番目の月', 'arid': '89ad4ac3-39f7-470e-963a-56509c546377', 'tracks': '10'}
Sending event: import_task_created
ignoring b'.DS_Store' due to ignore rule b'.*'
Sending event: import_task_created
ignoring b'.DS_Store' due to ignore rule b'.*'
Sending event: import_task_created
ignoring b'.DS_Store' due to ignore rule b'.*'
Sending event: import_task_created
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 497, in _safe_read
    f = opener.open(req)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/autotag/mb.py", line 508, in match_album
    limit=config['musicbrainz']['searchlimit'].get(int), **criteria)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 978, in search_releases
    return _do_mb_search('release', query, fields, limit, offset, strict)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 782, in _do_mb_search
    return _do_mb_query(entity, '', [], params)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 728, in _do_mb_query
    return _mb_request(path, 'GET', auth_required, args=args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 417, in __call__
    return self.fun(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 690, in _mb_request
    resp = _safe_read(opener, req, body)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/musicbrainzngs/musicbrainz.py", line 525, in _safe_read
    raise NetworkError(cause=exc)
musicbrainzngs.musicbrainz.NetworkError: caused by: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

Error: MusicBrainz not reachable in release search with query {'release': '14番目の月', 'arid': '89ad4ac3-39f7-470e-963a-56509c546377', 'tracks': '10'}

Setup

  • OS: macOS High Sierra
  • Python version: 2.7.16 - I’m not sure, it is hell to keep track of this as a non-programmer. I know I updated to 3 at some point, but if I write python it says Python 2.7.16 (default, Jan 26 2020, 23:50:38) . Not sure what beet is using.
  • beets version: 1.5.0

My configuration (output of beet config) is:

directory: /Volumes/Expansion-1/Media/Audio/

plugins: convert discogs duplicates fetchart embedart lyrics missing zero

autotag: yes

art_filename: cover

clutter: .pdf .bmp .png .jpg .jpef .tif .gif .sfv .nfo .m3u .log .DS_Store Thumbs.DB Thumbs.db

original_date: yes

languages: en

va_name: Various

ignored_media: .vob .mp4 .mkv .avi .ts .pdf .cbz .cbr

import:
    copy: no
    write: yes
    move: yes

paths:
    default: $albumartist/$album%aunique{albumartist album, tracktotal year label,()}/$track. $title
    comp: Various/$album%aunique{albumartist album, tracktotal year label,()}/$track. $title
    albumartist:various artists: Various/$album%aunique{albumartist album, tracktotal year label,()}/$track. $title
replace:
    '[\\/]': _
    '^\.': _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    '\.$': _
    '\s+$': ''
    '^\s+': ''
    '^-': _
convert:
    tmpdir: /Volumes/Expansion-1/Media/Audio/
    auto: yes
    delete_originals: yes
    never_convert_lossy_files: yes
    format: mp3
    mp3:
      command: ffmpeg -i $source -q:a 0 -map_metadata 0 $dest
      extension: mp3
discogs:
    user_token: redacted
duplicates:
    album: yes
    move: /Users/redacted/Downloads/
fetchart:
    auto: yes
    sources: fanarttv itunes amazon coverart albumart google
    fanarttv_key: redacted
    google_API_key: redacted
embedart: 
    auto: yes
    maxwidth: 1000
lyrics:
    auto: yes
    force: yes
    sources: genius musixmatch lyricwiki google
    google_API_key: redacted
    fallback: ''
    import.write: yes
chroma:
    auto: no
zero:
    auto: yes
    update_database: true
    keep_fields:        
        - artist
        - title
        - album
        - year
        - composer
        - albumartist
        - track
        - tracktotal
        - disc
        - disctotal
        - label
        - acoustid_fingerprint
        - acoustid_id
        - albumtype
        - lyrics
        - unsyncedlyrics
        - images
        - rating
        - first played
        - last played
        - play count

https://github.com/beetbox/beets/issues/3052#issuecomment-430325851 didn’t work. It was already installed, and the error persists.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wisp3rwindcommented, Jun 3, 2021

I lack the knowledge to comment on the SSL problem directly; but looking at the log ("/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/autotag/mb.py"), you’re running beets on Python 3.7, not 2.7. So you’d need to apply any fix from the linked thread to Python 3.7, too.

0reactions
wisp3rwindcommented, Jun 18, 2021

Moving this to Discussions, as this is most likely not a bug with beets.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Solved] Picard cannot fetch data from Musicbrainz.org
Since this morning, Picard has been unable to fetch music info from the musicbrainz.org database. Version: Picard 2.3.2, Python 3.8.3, ...
Read more >
lastgenre plugin: [SSL: CERTIFICATE_VERIFY_FAILED] #3052
Problem Running this command in verbose (-vv) mode: $ beet -vv lastgenre -f danny byrd (Using the -f flag because: #2704) Led to...
Read more >
What's New - MusicBrainz Picard
Official website for MusicBrainz Picard, a cross-platform music tagger written in Python.
Read more >
Files are not being saved - MusicBrainz Picard
In that case the save button is disabled. Check to make sure that the files are properly matched to the tracks before trying...
Read more >
Account FAQ - MusicBrainz
5 Why won't the login page accept my username and password? ... entered and confirmed your email address, then use the Forgot your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found