Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when beatport_token.json is present but has wrong format #11

Closed
mkataja opened this issue Apr 10, 2023 · 2 comments
Closed

Crash when beatport_token.json is present but has wrong format #11

mkataja opened this issue Apr 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mkataja
Copy link

mkataja commented Apr 10, 2023

Got the following traceback after installing and configuring the plugin with beatport username and password and running beets import:

Traceback (most recent call last):
  File "~/.pyenv/versions/3.8.10/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "~/.pyenv/versions/3.8.10/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/__main__.py", line 24, in <module>
    main(sys.argv[1:])
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/importer.py", line 337, in run
    plugins.send('import_begin', session=self)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/plugins.py", line 488, in send
    result = handler(**arguments)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beets/plugins.py", line 145, in wrapper
    return func(*args, **kwargs)
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beetsplug/beatport4.py", line 528, in setup
    beatport_token = BeatportOAuthToken(json.load(f))
  File "~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/beetsplug/beatport4.py", line 47, in __init__
    self.access_token = str(data['access_token'])
KeyError: 'access_token'

I noticed ~/.config/beets/beatport_token.json already exists. I suppose this file was left by the old beatport plugin (?) and is probably not in the format beatport4 expects, hence the crash. The issue was resolved simply by removing the file.

@Samik081
Copy link
Owner

Hey, thank you for reporting this issue! :)
This seems right, the old token format will probably not be parsed correctly. I will fix this next week.

@Samik081
Copy link
Owner

Samik081 commented Jun 9, 2023

Hey @mkataja, took me while, and sorry for that. This issue should be already fixed in the v0.3.3 with 8171cfc

@Samik081 Samik081 closed this as completed Jun 9, 2023
@Samik081 Samik081 added the bug Something isn't working label Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants