-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
auto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automationstate: awaiting PRFeature discussed, PR is neededFeature discussed, PR is neededtype: enhancementImprovements to functionalityImprovements to functionality
Description
Environment
- pip version: 19.3.1
- Python version: 3.7.5 (modified)
- OS: Windows 10
The version of Python I am using is modified for security. Most importantly, ctypes is removed.
Description
Without ctypes available, appdirs will automatically use the _get_win_folder_from_registry function.
However, this function has not been updated for Python 3's winreg module - it tries/fails to import _winreg (the Python 2.x name).
Expected behavior
How to Reproduce
- Rename
DLLs\_ctypes.pydto any other name, or move it elsewhere. (Or any other mechanism you like to prevent it from being imported) - Then run
pip --version - An error occurs.
Output
(testenv) PS C:\testenv> pip --version
File "C:\Python37_x64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python37_x64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\testenv\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\testenv\lib\site-packages\pip\_internal\main.py", line 13, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "c:\testenv\lib\site-packages\pip\_internal\cli\autocompletion.py", line 11, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "c:\testenv\lib\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "c:\testenv\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 25, in <module>
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
File "c:\testenv\lib\site-packages\pip\_internal\locations.py", line 28, in <module>
USER_CACHE_DIR = appdirs.user_cache_dir("pip")
File "c:\testenv\lib\site-packages\pip\_internal\utils\appdirs.py", line 47, in user_cache_dir
path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
File "c:\testenv\lib\site-packages\pip\_internal\utils\appdirs.py", line 207, in _get_win_folder_from_registry
import _winreg
ModuleNotFoundError: No module named '_winreg'
Metadata
Metadata
Assignees
Labels
auto-lockedOutdated issues that have been locked by automationOutdated issues that have been locked by automationstate: awaiting PRFeature discussed, PR is neededFeature discussed, PR is neededtype: enhancementImprovements to functionalityImprovements to functionality