beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.68k stars 1.81k forks source link

NameError: name 'BeautifulSoup' is not defined #2930

Closed MorgothSauron closed 6 years ago

MorgothSauron commented 6 years ago

Problem

Executing "beet import" on a new album downloaded from Amazon fails with error NameError: name 'BeautifulSoup' is not defined. Disabling the lyrics plugin does not trigger this error.

Same error occurs with beet lyrics album:'Cabaret De La Guillotine'. No problem executing that command on few artists randomly selected.

Running this command in verbose (-vv) mode:

$ beet -vv
overlaying configuration: /home/myuser/Music/.beets/config.yaml
user configuration: /home/myuser/.config/beets/config.yaml
data directory: /home/myuser/.config/beets
plugin paths: 
Sending event: pluginload
/usr/lib/python3.6/site-packages/beets/plugins.py:114: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(func)
lyrics: Disabling google source: no API key configured.
library database: /home/myuser/Music/.beets/BeetMusicLibrary.blb
library directory: /home/myuser/Music
Sending event: library_opened
Usage: 
  beet COMMAND [ARGS...]
  beet help COMMAND

Options:
  --format-item=FORMAT_ITEM
                        print with custom format
  --format-album=FORMAT_ALBUM
                        print with custom format
  -l LIBRARY, --library=LIBRARY
                        library database file to use
  -d DIRECTORY, --directory=DIRECTORY
                        destination music directory
  -v, --verbose         log more details (use twice for even more)
  -c CONFIG, --config=CONFIG
                        path to configuration file
  -h, --help            show this help message and exit

Commands:
  clearart          remove images from file metadata
  config            show or edit the user configuration
  embedart          embed image files into file metadata
  extractart        extract an image from file metadata
  fetchart          download album art
  fields            show fields available for queries and format strings
  help (?)          give detailed help on a specific sub-command
  import (imp, im)  import new music
  info              show file metadata
  list (ls)         query the library
  lyrics            fetch song lyrics
  modify (mod)      change metadata fields
  move (mv)         move or copy items
  remove (rm)       remove matching items from the library
  stats             show statistics about the library or a query
  update (upd, up)  update the library
  version           output version information
  write             write tag information to files
Sending event: cli_exit
$ 

Led to this problem:

$ beet import .
/usr/lib/python3.6/site-packages/beets/plugins.py:114: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(func)

/home/myuser/Downloads/tmp (10 items)
Correcting tags from:
    Angelus Apatrida - Cabaret De La Guillotine [Explicit]
To:
    Angelus Apatrida - Cabaret De La Guillotine
URL:
    https://musicbrainz.org/release/184a59fe-b9b5-46f3-93b9-29ebe4e80d62
(Similarity: 98.1%) (tracks, album) (Digital Media, 2018, FR, Century Media)
 * One of Us [Explicit]       -> One of Us (title)
 * The Die Is Cast [Explicit] -> The Die Is Cast (title)
Traceback (most recent call last):
  File "/usr/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.6', 'console_scripts', 'beet')()
  File "/usr/lib/python3.6/site-packages/beets/ui/__init__.py", line 1256, in main
    _raw_main(args)
  File "/usr/lib/python3.6/site-packages/beets/ui/__init__.py", line 1243, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python3.6/site-packages/beets/ui/commands.py", line 937, in import_func
    import_files(lib, paths, query)
  File "/usr/lib/python3.6/site-packages/beets/ui/commands.py", line 914, in import_files
    session.run()
  File "/usr/lib/python3.6/site-packages/beets/importer.py", line 327, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/lib/python3.6/site-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/lib/python3.6/site-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/lib/python3.6/site-packages/beets/importer.py", line 1506, in plugin_stage
    func(session, task)
  File "/usr/lib/python3.6/site-packages/beets/plugins.py", line 124, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 805, in imported
    False, self.config['force'])
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 818, in fetch_item_lyrics
    lyrics = [self.get_lyrics(artist, title) for title in titles]
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 818, in <listcomp>
    lyrics = [self.get_lyrics(artist, title) for title in titles]
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 851, in get_lyrics
    lyrics = backend.fetch(artist, title)
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 388, in fetch
    return self.lyrics_from_song_api_path(song_api_path)
  File "/usr/lib/python3.6/site-packages/beetsplug/lyrics.py", line 363, in lyrics_from_song_api_path
    html = BeautifulSoup(page.text, "html.parser")
NameError: name 'BeautifulSoup' is not defined
$ 

Here's a link to the music files that trigger the bug (if relevant):

Setup

My configuration (output of beet config) is:

/usr/lib/python3.6/site-packages/beets/plugins.py:114: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
  argspec = inspect.getargspec(func)
lyrics:
    bing_lang_from: []
    auto: yes
    force: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    local: no
    sources:
    - google
    - lyricwiki
    - musixmatch
    - genius
library: /home/myuser/Music/.beets/BeetMusicLibrary.blb
directory: /home/myuser/Music

ui:
    color: yes
    colors:
        text_success: green
        text_warning: yellow
        text_error: red
        text_highlight: red
        text_highlight_minor: lightgray
        action_default: turquoise
        action: blue

import:
    copy: no
    write: yes
    move: yes

plugins: embedart fetchart info lyrics
embedart:
    auto: yes
    maxwidth: 0
    compare_threshold: 0
    ifempty: no
    remove_art_file: no

paths:
    default: $albumartist/$album%aunique{}/$track $title
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$track $title
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    store_source: no
sampsyo commented 6 years ago

Hi! Can you try the latest source? I think this may have been fixed in #2912.

MorgothSauron commented 6 years ago

Using beet from the master branch (1.4.7) worked:

$ ./beet --config=/home/myuser/Music/.beets/config.yaml --library=/home/myuser/Music/.beets/BeetMusicLibrary.blb --directory=/home/m^Crpentier/Music lyrics album:"Cabaret De La Guillotine"
lyrics: fetched lyrics: Angelus Apatrida - Cabaret De La Guillotine - Sharpen the Guillotine
lyrics: lyrics not found: Angelus Apatrida - Cabaret De La Guillotine - Betrayed
lyrics: fetched lyrics: Angelus Apatrida - Cabaret De La Guillotine - Ministry of God
lyrics: lyrics not found: Angelus Apatrida - Cabaret De La Guillotine - The Hum
lyrics: fetched lyrics: Angelus Apatrida - Cabaret De La Guillotine - Downfall of the Nation
lyrics: lyrics not found: Angelus Apatrida - Cabaret De La Guillotine - One of Us
lyrics: fetched lyrics: Angelus Apatrida - Cabaret De La Guillotine - The Die Is Cast
lyrics: lyrics not found: Angelus Apatrida - Cabaret De La Guillotine - Witching Hour
lyrics: lyrics not found: Angelus Apatrida - Cabaret De La Guillotine - Farewell
lyrics: fetched lyrics: Angelus Apatrida - Cabaret De La Guillotine - Martyrs of Chicago
$

I don't know if it's related to the new version, but I had to install two modles: munkres and musicbrainzngs.

sampsyo commented 6 years ago

Awesome; thanks!