File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change
1
+ Do not break with FileNotFoundError when loading site-config-dir location from windows registry (CSIDL_COMMON_APPDATA).
Original file line number Diff line number Diff line change @@ -44,9 +44,15 @@ def site_config_dirs(appname: str) -> list[str]:
44
44
dirval = _appdirs .site_data_dir (appname , appauthor = False , multipath = True )
45
45
return dirval .split (os .pathsep )
46
46
47
- dirval = _appdirs .site_config_dir (appname , appauthor = False , multipath = True )
48
47
if sys .platform == "win32" :
49
- return [dirval ]
48
+ try :
49
+ # Causes FileNotFoundError on attempt to access a registry key that does
50
+ # not exist. This should not break apart pip configuration loading.
51
+ dirval = _appdirs .site_config_dir (appname , appauthor = False , multipath = True )
52
+ return [dirval ]
53
+ except FileNotFoundError :
54
+ return []
50
55
51
56
# Unix-y system. Look in /etc as well.
57
+ dirval = _appdirs .site_config_dir (appname , appauthor = False , multipath = True )
52
58
return dirval .split (os .pathsep ) + ["/etc" ]
You can’t perform that action at this time.
0 commit comments