Fix #6176: Clear error message when EDITOR not set#6311
Open
MatMacinf wants to merge 3 commits intobeetbox:masterfrom
Open
Fix #6176: Clear error message when EDITOR not set#6311MatMacinf wants to merge 3 commits intobeetbox:masterfrom
MatMacinf wants to merge 3 commits intobeetbox:masterfrom
Conversation
Author
|
All testing was done on docker image without vi or any other text editor, please let me know if more test is required. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6311 +/- ##
=======================================
Coverage 68.77% 68.77%
=======================================
Files 140 140
Lines 18619 18619
Branches 3054 3054
=======================================
Hits 12806 12806
Misses 5165 5165
Partials 648 648
🚀 New features to boost your workflow:
|
|
Nice! just installed today and ran into this confusing error. |
snejus
requested changes
Jan 27, 2026
beets/ui/commands/config.py
Outdated
| except OSError as exc: | ||
| message = f"Could not edit configuration: {exc}" | ||
| if not editor: | ||
| if exc.errno == 2 or not editor: |
Member
There was a problem hiding this comment.
The message below may be a bit misleading in this case because this fails when the user has set the environment variable, but their supplied editor does not exist.
Instead, consider handling FileNotFoundError specifically:
diff --git a/beets/ui/commands/config.py b/beets/ui/commands/config.py
index 15d571324..318985e7f 100644
--- a/beets/ui/commands/config.py
+++ b/beets/ui/commands/config.py
@@ -56,2 +56,4 @@ def config_edit
interactive_open([path], editor)
+ except FileNotFoundError:
+ raise ui.UserError(f"Editor {editor!r} not found.")
except OSError as exc:
docs/changelog.rst
Outdated
|
|
||
| Bug fixes: | ||
|
|
||
| - Added case when none of the editors is present in the environment. :bug:`6176` |
Member
There was a problem hiding this comment.
Suggested change
| - Added case when none of the editors is present in the environment. :bug:`6176` | |
| - :ref:`config-cmd`: Improved error message when user-configured editor does not exist. :bug:`6176` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes # #6176.
(...)
To Do
Documentation.(If you've added a new command-line flag, for example, find the appropriate page underdocs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)Tests.(Very much encouraged but not strictly required.)Changed one line to ensure expected behavior as mentioned in the issue, now
beet config -ewill have info message when no text editor is available.