beetbox / beets

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

beet update cli ends with "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType" #2520

Closed avma closed 7 years ago

avma commented 7 years ago

### Problem hi

when running beet update command, it ends with "TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType" without actualy doing anything.

Running this command in verbose (-vv) mode: beet -vv update

$ beet -vv (... paste here ...)

Led to this problem:

pi@RASPI3-DELUGE:~ $  beet update
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.3', 'console_scripts', 'beet')()
  File "/usr/local/lib/python3.6/site-packages/beets/ui/__init__.py", line 1209, in main
    _raw_main(args)
  File "/usr/local/lib/python3.6/site-packages/beets/ui/__init__.py", line 1196, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python3.6/site-packages/beets/ui/commands.py", line 1149, in update_func
    opts.pretend, opts.fields)
  File "/usr/local/lib/python3.6/site-packages/beets/ui/commands.py", line 1063, in update_items
    if not os.path.exists(syspath(item.path)):
  File "/usr/local/lib/python3.6/genericpath.py", line 19, in exists
    os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
pi@RASPI3-DELUGE:~ $

Setup

My configuration (output of beet config) is:

config.yaml

directory: /mnt/media/music/mymusic library: /mnt/media/data/beets.blb import:

write: yes
move: yes
copy: no
delete: no
autotag: yes
timid: no

resume: ask
incremental: no
none_rec_action: ask
log:

quiet: no  # enable with command line option
quiet_fallback: skip
default_action: apply

singletons: no
languages: []
detail: no
flat: no

original_date: no per_disc_numbering: no clutter: ["desktop.ini", "Thumbs.DB", ".DS_Store", ".m3u", ".m3u8", ".pls", ".jpg"] ignore: [".", "*~", "System Volume Information"]

paths: default: %asciify{$albumartist}/%asciify{$album}%aunique{}/$track. %asciify{$title} singleton: Non-Album/%asciify{$artist}/%asciify{$title} comp: Compilations/%asciify{$album}%aunique{}/$track. %asciify{$title}

replace: '[\/]': '^.': '[\x00-\x1f]': '[<>:"\?*|]': '.$': _ '\s+$': ''

path_sepreplace:

art_filename: cover # results in "cover.jpg" max_filename_length: 0 # unlimited

threaded: yes timeout: 5.0 verbose: no

color: yes list_format_item: %upper{$artist} - $album - $track. $title list_format_album: %upper{$albumartist} - $album time_format: '%d-%m-%Y %H:%M:%S' terminal_encoding: utf8

ui: terminal_width: 80 length_diff_thresh: 10.0

match: strong_rec_thresh: 0.1 # match 90% or better for auto import medium_rec_thresh: 0.25 rec_gap_thresh: 0.25 max_rec: missing_tracks: medium unmatched_tracks: medium distance_weights: source: 2.0 artist: 3.0 album: 3.0 media: 1.0 mediums: 1.0 year: 1.0 country: 0.5 label: 0.5 catalognum: 0.5 albumdisambig: 0.5 album_id: 5.0 tracks: 2.0 missing_tracks: 0.9 unmatched_tracks: 0.6 track_title: 3.0 track_artist: 2.0 track_index: 1.0 track_length: 2.0 track_id: 5.0 preferred: countries: [] media: [] original_year: no ignored: [] track_length_grace: 10 track_length_max: 30

plugins: [ mbcollection, discogs, lyrics, fetchart, embedart, lastgenre, scrub, mbsync, missing, duplicates, copyartifacts, lastimport, importadded, web ] pluginpath: []

musicbrainz: user: xxx pass: xxx

lyrics: auto: yes import.wrire: yes fallback: '' sources: google lyricwiki lyrics.com musixmatch genius.com google_API_key: xxx

echonest_tempo: auto: yes

lastgenre: auto: yes whitelist: yes
canoncical: yes
fallback: '' source: album
separator: '/'

fetchart: auto: yes

maxwidth: 300

cautious: true
cover_names: cover folder back cd artist fold inside inlay booklet

embedart: auto: yes

maxwidth: 300

replaygain: auto: yes overwrite: yes albumgain: yes

scrub: auto: yes

copyartifacts: extensions: .* missing: format: $albumartist - $album - $track - $title count: yes total: yes

duplicates: checksum: no # expensive

lastfm: user:

importadded: preserve_mtimes: yes preserve_write_mtimes: yes

web: host: 0.0.0.0

sampsyo commented 7 years ago

Hmm; that's strange! Does this happen for all files that you update, or does the command work if you target specific music? What does the output of beet ls -p look like? (Also, would you mind cleaning up the formatting of your configuration paste?)

avma commented 7 years ago

yes it happens for all files, or Specified folders. this is just a small part of it... ;)

/mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/03. Walk Away.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/04. Male Version of Me.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/05. Open.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/06. Clay Heart.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/07. Neither the Beginning nor the End.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/08. Horatio.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/09. Honey.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/10. Segment.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/11. The Answer's in the Question.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/12. Curtain Call.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/13. The Band Called Out for More.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/01. Umm.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/02. Ladies of the Lake.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/03. Ladies of the Lake (Reprise).mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/04. Ones That Got Away.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/05. We're All in This Together.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/06. Lipsink.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/07. Whose House_.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/08. Sour.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/09. Ask You a Question.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/10. (Horatio Intro...).mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/11. Maybe.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/12. Too Young to Die.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/13. Two by Two.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/14. Snakebite.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/15. Mole.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/16. Down.mp3 /mnt/media/music/mymusic/Gabby Young & Other Animals/We're All in This Together (Special Edition)/17. Button.mp3 /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/01. Better Off Dead.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/02. Undecided.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/03. Hernando's Hideaway.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/04. It Don't Mean a Thing (If It Ain't Got That Swing).flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/05. Sugar.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/06. All of Me.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/07. Caravan.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/08. If You Were Mine.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/09. When I Get Low I Get High.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/10. I Can't Give You Anything but Love.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/11. Nice Work If You Can Get It.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/12. If I Could Be With You One Hour Tonight.flac /mnt/media/music/mymusic/Linnzi Zaorski & Delta Royale/Hotsy-Totsy/13. Evenin'.flac /mnt/media/music/mymusic/Club des Belugas/NINE/26. Zouzoulectric - Round Around (Club Des Belugas remix).flac

avma commented 7 years ago

another strange thing happening (i'm not sure it is related but assuming it is) is when i run the beet move cli, it dose not do anything either: pi@RASPI3-DELUGE:~ $ beet move /mnt/media/finished/lust error: No matching items found.

pi@RASPI3-DELUGE:~ $ cd /mnt/media/finished/lust pi@RASPI3-DELUGE:/mnt/media/finished/lust $

sampsyo commented 7 years ago

So, just to double check, this command leads to the same error?

$ beet update '/mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/03. Walk Away.mp3'

About this:

pi@RASPI3-DELUGE:~ $ beet move /mnt/media/finished/lust
error: No matching items found.

It doesn't look like you have any music tracked in that directory, so this is to be expected.

avma commented 7 years ago

this used to work for me just fine a few days ago, i was moving folders around quit a bit.

actually there are music files and jpg s in that directory as you can see below:

pi@RASPI3-DELUGE:/mnt/media/finished/lust $ ls "01. On the Hook.mp3 03. She Treats Me Right.mp3 05. Slippin' Away.mp3 07. Nothing to Me.mp3 09. Ain't No Hoodoo.mp3 11. No White Horses.mp3 cover.jpg inside1.jpg

  1. Gonna Make You Love Me.mp3 04. I Got Trouble.mp3 06. I Don't Know Nothing.mp3 08. Alone and Crying.mp3 10. Up Jumped the Devil.mp3 cd.jpg front.jpg inside2.jpg" pi@RASPI3-DELUGE:/mnt/media/finished/lust $
sampsyo commented 7 years ago

But beets doesn't know about them—hence the "no matching items found". You can try beet ls to check this.

Did you try the other command I mentioned above?

avma commented 7 years ago

yup...looks like it recognizes a single file but nut the entire library. pi@RASPI3-DELUGE:~ $ beet -vv update '/mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/03. Walk Away.mp3' user configuration: /home/pi/.config/beets/config.yaml data directory: /home/pi/.config/beets plugin paths: Sending event: pluginload library database: /mnt/media/data/beets.blb library directory: /mnt/media/music/mymusic Sending event: library_opened skipping /mnt/media/music/mymusic/Gabby Young & Other Animals/The Band Called Out for More/03. Walk Away.mp3 because mtime is up to date (1490433969.0) Sending event: cli_exit pi@RASPI3-DELUGE:~ $

sampsyo commented 7 years ago

Sounds like there's a problem with a specific item then. Can you please find out which one? For example, you could use verbose mode to help indicate which file is being processed.

Also, you can format pasted terminal output correctly on GitHub by surrounding it in ```. (There are some examples in our issue template.)

avma commented 7 years ago

when running cli beet update '/mnt/media/music/mymusic/' the process completes successfully without any errors. but beet update (which worked for me in the past) still does not work (ends with the same error mentioned above). yea, and thanks for the format tip, i was struggling with it a bit...

sampsyo commented 7 years ago

OK—did you have a chance to check which file is causing the problem using verbose mode as I suggested in the previous comment?

avma commented 7 years ago

yes but non was actually causing a problem, with beet update '/mnt/media/music/mymusic/' update ended smoothly without any problems or errors, doing what was expected; moving, deleting updating and skipping stuff.

avma commented 7 years ago

it looks like running beet update (without '/mnt/media/music/mymusic/' ) does not recognise the path stated in the config.yaml file.

it is not such a big a problem, for i can always type the full path in the cli, its just being strange that it suddenly stopped doing it.

sampsyo commented 7 years ago

Running beet update affects all the music in your library. Running beet update /some/path only affects tracks under that path—it's a query that selects a subset of your library. So there's an offending track causing problems that's outside of that directory.

We can keep trying to narrow down the problem if you're interested, with that verbose run! Otherwise I'll close this issue.

avma commented 7 years ago

humm, this is strange, for i don't have any music on /mnt other than what resides under '/mnt/media/music/mymusic/' (about 200 sub folders with 2600 tracks).

i'll recheck maybe there is a hidden file/folder i am not aware of. anyway as i said before, this is not a biggie so go ahead and close this issue and thank you very much for all your help and the great job you are doing on beets it is a great media library management program and much more!

sampsyo commented 7 years ago

OK! I'll close it for now. But in case you want to dig farther, running in verbose mode will probably help.