diff --git a/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md b/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md new file mode 100644 index 00000000000..3ed9d56f102 --- /dev/null +++ b/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Fix PermissionError when detecting package manager on WSL \ No newline at end of file diff --git a/packages/http-client-python/eng/scripts/setup/package_manager.py b/packages/http-client-python/eng/scripts/setup/package_manager.py index 87235ef690a..3b6698279d9 100644 --- a/packages/http-client-python/eng/scripts/setup/package_manager.py +++ b/packages/http-client-python/eng/scripts/setup/package_manager.py @@ -25,7 +25,7 @@ def _check_command_available(command: str) -> bool: try: subprocess.run([command, "--version"], capture_output=True, check=True) return True - except (subprocess.CalledProcessError, FileNotFoundError): + except (subprocess.CalledProcessError, FileNotFoundError, PermissionError): return False @@ -50,7 +50,7 @@ def detect_package_manager() -> str: try: subprocess.run([sys.executable, "-m", "pip", "--version"], capture_output=True, check=True) return "python -m pip" - except (subprocess.CalledProcessError, FileNotFoundError): + except (subprocess.CalledProcessError, FileNotFoundError, PermissionError): pass raise PackageManagerNotFoundError("No suitable package manager found. Please install either uv or pip.")