whatlastgenre icon indicating copy to clipboard operation
whatlastgenre copied to clipboard

AttributeError on `beet import -L`

Open JOJ0 opened this issue 3 years ago • 1 comments

$ beet import -L long beach                                                                            ✔ 
Traceback (most recent call last):
  File "/usr/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets', 'console_scripts', 'beet')())
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 946, in import_files
    plugins.send('import', lib=lib, paths=paths)
  File "/home/jojo/git/beets/beets/plugins.py", line 488, in send
    result = handler(**arguments)
  File "/home/jojo/git/beets/beets/plugins.py", line 145, in wrapper
    return func(*args, **kwargs)
  File "/home/jojo/git/whatlastgenre/plugin/beets/beetsplug/wlg.py", line 71, in setdown
    self.wlg.cache.save()
AttributeError: 'NoneType' object has no attribute 'cache'

Any ideas how to fix this? I would look into it if you could give me some startingpoints @YetAnotherNerd . Thanks in advance!

REgular calling of wlg works:

$ beet wlg long beach                                                                                1 ✘ 

Time elapsed: 0:00:00.004315 (0:00:00.004315 per directory)

$

JOJ0 avatar Jan 15 '22 09:01 JOJ0

@YetAnotherNerd It happens for example when --incremental is used and a folder was skipped. It seems wlg tries to do something even when there is nothing to do - non-technically speaking. Also the error happens when no match is found when importing. Since you know your codebase well - before I dig in - any hints where to start looking? Thanks in advance!

JOJ0 avatar Feb 18 '22 08:02 JOJ0

Hi @YetAnotherNerd I fixed this in my clone of wlg and have it in use for months without a problem. Would you accept a PR?

JOJ0 avatar Dec 23 '22 13:12 JOJ0

@JOJ0 Sorry to revive this, but I didn't see a PR for this fix you mention. Could you share your edits? I am running into this issue too.

Wolframme avatar Jan 12 '24 20:01 Wolframme

@Wolframme only if you open that PR for me then? too many projects... 😄

JOJ0 avatar Jan 14 '24 21:01 JOJ0

@JOJ0 Then we're at a dead end if you don't have your work in your own fork to make a PR from.

Wolframme avatar Jan 15 '24 04:01 Wolframme

@Wolframme appologies, I realized that I didn't have a fork yet and that fix also wasn't on the computer I was working with yesterday. Since I had to look it up on another machine and push it to my newly created fork, I quickly opened that PR finally :-) Please head over there and give it some testing and possibly suggestions. Thanks!

JOJ0 avatar Jan 15 '24 06:01 JOJ0