diff --git a/CHANGELOG.md b/CHANGELOG.md index a45ec8c4c4..7f5443637a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## dev +- Fix "Failed to delete" error when using Microsoft Store Python - Fix "No pyvenv.cfg file" error when using Microsoft Store Python (#1164) - Add `--quiet` and `--verbose` options for the `pipx` subcommands - [docs] Add Scoop installation instructions diff --git a/src/pipx/util.py b/src/pipx/util.py index 2a9965ef4b..4bba09d6f5 100644 --- a/src/pipx/util.py +++ b/src/pipx/util.py @@ -55,7 +55,9 @@ def rmdir(path: Path, safe_rm: bool = True) -> None: logger.info(f"removing directory {path}") try: if WINDOWS: - os.system(f'rmdir /S /Q "{str(path)}"') + # The packaged app (Microsoft Store) version of Python uses path redirections, but `rmdir` won't follow + # these, so use realpath() to manually apply the redirection first. + os.system(f'rmdir /S /Q "{os.path.realpath(path)}"') else: shutil.rmtree(path) except FileNotFoundError: