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

Let `beet config -e` work even when the configuration file can't be parsed #1123

Closed
azrdev opened this Issue Nov 30, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@azrdev

azrdev commented Nov 30, 2014

Under some circumstances, beets and/or the config command fail, which can be fixed by changing the config file - thus, the user has to find & edit that by hand, since the command fails. Examples:

  1. Upon upgrade to v1.3.9, the discogs plugin wanted an auth token from me, which it requested on beets startup. Since I didn't supply one, beets failed, until I removed the plugins activation from the configuration
  2. Make a syntax error in the config file, e.g. a yaml "collection" without any value in it, and watch all beets commands fail since it cannot read the file. This works even when editing "through" beets.

@sampsyo sampsyo added the needinfo label Nov 30, 2014

@sampsyo

This comment has been minimized.

Member

sampsyo commented Nov 30, 2014

Good point, although neither of these will be easy to solve.

Can you elaborate on how beets "failed" when discogs was broken? Was there a traceback?

@azrdev

This comment has been minimized.

azrdev commented Nov 30, 2014

$ beet version
To authenticate with Discogs, visit:
http://www.discogs.com/oauth/authorize?oauth_token=dLTKUZxKWdAbABnORoErTjorzZwEZpijPbzjLZXp
Enter the code: 
error: Discogs authorization failed
$ echo $?                                                                                                                                :(
1

Dunno if this counts as broken, I just didn't supply a code (since the link asks to log in with an account, which I don't have)

sampsyo added a commit that referenced this issue Nov 30, 2014

discogs: Only authenticate on import (#1123)
No need to authenticate for other commands.

@sampsyo sampsyo added feature and removed needinfo labels Nov 30, 2014

@sampsyo

This comment has been minimized.

Member

sampsyo commented Nov 30, 2014

Aha, thanks for clarifying! I'm pushing a fix now that makes the plugin only ask for authentication when running an import, so that should solve that half.

The other component here will be somewhat trickier. We need to parse the configuration file before dispatching commands (for plugins' sake), so parse errors can get in the way. I think the best way to make config -e still work, which is a good idea, would be to hard-code that particular invocation. This would happen in beets.ui._raw_main after the global options are parsed but before we call _setup. I'll leave this open to remind us to do that.

@sampsyo sampsyo changed the title from "config" command not always accessible, need to manually find & edit the file to Let `beet config -e` work even when the configuration file can't be parsed Nov 30, 2014

geigerzaehler added a commit to geigerzaehler/beets that referenced this issue Dec 1, 2014

sampsyo added a commit that referenced this issue Dec 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment