diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f5443637a..9740f84cf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## dev +- Delete directories directly instead of spawning rmdir on Windows - 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 diff --git a/src/pipx/util.py b/src/pipx/util.py index 4bba09d6f5..3e899aa69e 100644 --- a/src/pipx/util.py +++ b/src/pipx/util.py @@ -54,12 +54,7 @@ def rmdir(path: Path, safe_rm: bool = True) -> None: logger.info(f"removing directory {path}") try: - if WINDOWS: - # 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) + shutil.rmtree(path) except FileNotFoundError: pass