From 3798ac5d02eb52c940d175f4c497a12a4b53fcd0 Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Sat, 19 Oct 2024 12:24:30 +1000 Subject: [PATCH 1/6] Add a quick check for MST Store Python install --- beets/ui/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 39ef7d2915..cf407d5c85 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1858,6 +1858,14 @@ def main(args=None): """Run the main command-line interface for beets. Includes top-level exception handlers that print friendly error messages. """ + if "AppData\\Local\\Microsoft\\WindowsApps" in sys.exec_prefix: + log.error( + "error: beets is unable to use the Microsoft Store version of Python. Please install Python from python.org." + ) + log.error( + "error: More details can be found here https://beets.readthedocs.io/en/stable/guides/main.html" + ) + sys.exit(1) try: _raw_main(args) except UserError as exc: From f0f77aa7410c89e51ae0da3d732341023961e21e Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Sat, 19 Oct 2024 12:25:01 +1000 Subject: [PATCH 2/6] Update related window files to match 3.8 --- docs/guides/main.rst | 2 +- extra/beets.reg | Bin 464 -> 464 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/main.rst b/docs/guides/main.rst index 9468a8c502..737230b9d4 100644 --- a/docs/guides/main.rst +++ b/docs/guides/main.rst @@ -109,7 +109,7 @@ get it right: should open the "System Properties" screen, then select the "Advanced" tab, then hit the "Environmental Variables..." button, and then look for the PATH variable in the table. Add the following to the end of the variable's value: - ``;C:\Python37;C:\Python37\Scripts``. You may need to adjust these paths to + ``;C:\Python38;C:\Python38\Scripts``. You may need to adjust these paths to point to your Python installation. 3. Now install beets by running: ``pip install beets`` diff --git a/extra/beets.reg b/extra/beets.reg index c02303d3d896c404e45cc5fa6e0038e70d32db6d..84eb090adef0670d30ca45da7321f0744f0856bd 100644 GIT binary patch delta 13 Ucmcb>e1UmG9V4T~e1UmG9V4UJ Date: Sat, 19 Oct 2024 12:48:40 +1000 Subject: [PATCH 3/6] Manually format messages --- beets/ui/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index cf407d5c85..ecfc413eb9 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1860,10 +1860,12 @@ def main(args=None): """ if "AppData\\Local\\Microsoft\\WindowsApps" in sys.exec_prefix: log.error( - "error: beets is unable to use the Microsoft Store version of Python. Please install Python from python.org." + "error: beets is unable to use the Microsoft Store version of Python. " + "Please install Python from python.org." ) log.error( - "error: More details can be found here https://beets.readthedocs.io/en/stable/guides/main.html" + "error: More details can be found here " + "https://beets.readthedocs.io/en/stable/guides/main.html" ) sys.exit(1) try: From 22810b6720039699d17c46bcad04a5376e791113 Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Sat, 19 Oct 2024 13:01:32 +1000 Subject: [PATCH 4/6] Windows & VSCode & Python --- beets/ui/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index ecfc413eb9..ae2e9e6355 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1860,8 +1860,8 @@ def main(args=None): """ if "AppData\\Local\\Microsoft\\WindowsApps" in sys.exec_prefix: log.error( - "error: beets is unable to use the Microsoft Store version of Python. " - "Please install Python from python.org." + "error: beets is unable to use the Microsoft Store version of " + "Python. Please install Python from python.org." ) log.error( "error: More details can be found here " From ec4b26f986882e021f5a29d1e281ce9a76619ae5 Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Sat, 19 Oct 2024 14:09:23 +1000 Subject: [PATCH 5/6] Update changelog --- docs/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index d3a12ceef0..90b87dcf60 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -13,6 +13,11 @@ New features: many different artists at once. Bug fixes: + +* Check if running python from the Microsoft Store and provide feedback to install + from python.org. + :bug:`5467` + For packagers: Other changes: From 1d63bf987150f91ac83968dd442bdbc052b5427c Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Tue, 22 Oct 2024 18:58:30 +1000 Subject: [PATCH 6/6] Update error logging as suggested --- beets/ui/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index ae2e9e6355..79fbcd4c09 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1861,9 +1861,7 @@ def main(args=None): if "AppData\\Local\\Microsoft\\WindowsApps" in sys.exec_prefix: log.error( "error: beets is unable to use the Microsoft Store version of " - "Python. Please install Python from python.org." - ) - log.error( + "Python. Please install Python from https://python.org.\n" "error: More details can be found here " "https://beets.readthedocs.io/en/stable/guides/main.html" )