Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(windows) pdm use failed if PATH env contains folder with restricted access #1849

Closed
1 task done
MVKozlov opened this issue Apr 21, 2023 · 2 comments
Closed
1 task done
Labels
🐛 bug Something isn't working ⬆️ upstream bug Caused by a bug from the upstream dependencies

Comments

@MVKozlov
Copy link

MVKozlov commented Apr 21, 2023

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

  • create empty folder D:\restrictedFolder
  • restrict access to folder for current user (for example set access rights for Administrators only)
  • add folder to PATH environment variable
  • open new shell in project folder and try to pdm use

Actual behavior

[PermissionError]: [WinError 5] Access Denied D:\restrictedFolder

Traceback (most recent call last):
File "c:\python\python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python\python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "c:\python\python310\scripts\pdm.exe_main
.py", line 7, in
File "c:\python\python310\lib\site-packages\pdm\core.py", line 255, in main
return Core().main(args)
File "c:\python\python310\lib\site-packages\pdm\core.py", line 193, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "c:\python\python310\lib\site-packages\pdm\core.py", line 188, in main
self.handle(project, options)
File "c:\python\python310\lib\site-packages\pdm\core.py", line 154, in handle
command.handle(project, options)
File "c:\python\python310\lib\site-packages\pdm\cli\commands\use.py", line 31, in handle
actions.do_use(
File "c:\python\python310\lib\site-packages\pdm\cli\actions.py", line 617, in do_use
found_interpreters = list(dict.fromkeys(project.find_interpreters(python)))
File "c:\python\python310\lib\site-packages\pdm\project\core.py", line 664, in find_interpreters
for entry in finder.find_all(*args):
File "c:\python\python310\lib\site-packages\findpython\finder.py", line 103, in find_all
matched_python = set(self._find_all_python_versions())
File "c:\python\python310\lib\site-packages\findpython\finder.py", line 136, in _find_all_python_versions
yield from provider.find_pythons()
File "c:\python\python310\lib\site-packages\findpython\providers\path.py", line 25, in find_pythons
yield from self.find_pythons_from_path(path)
File "c:\python\python310\lib\site-packages\findpython\providers\base.py", line 44, in
return (
File "c:\python\python310\lib\pathlib.py", line 1017, in iterdir
for name in self._accessor.listdir(self):

Expected behavior

Interactive python selection. (may be with warning)
note: Everything works as it should when the shell is started with administrator rights.

Environment Information

> pdm info
PDM version:
  2.5.3
Python Interpreter:
  D:\Work\test\.venv\Scripts\python.exe (3.10)
Project Root:
  D:/Work/test

> pdm info --env
Local Packages:
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.9",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "10",
  "platform_system": "Windows",
  "platform_version": "10.0.19043",
  "python_full_version": "3.10.9",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "win32"
}```
@MVKozlov MVKozlov added the 🐛 bug Something isn't working label Apr 21, 2023
@frostming frostming added the ⬆️ upstream bug Caused by a bug from the upstream dependencies label Apr 25, 2023
@frostming
Copy link
Collaborator

You need to upgrade the version of findpython inside the environment of PDM.

@MVKozlov
Copy link
Author

@frostming, my findpython version is 0.2.4 - the latest, at the time of report and now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ⬆️ upstream bug Caused by a bug from the upstream dependencies
Projects
None yet
Development

No branches or pull requests

2 participants