-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Description
Calls to all appdirs functions that retrieve directory paths fail on Jython in Windows.
Some environments Jython runs in may have JNA. In those environments appdirs is successful. In most standard Java installs, this isn't the case, since JNA doesn't ship as part of Java.
How to Reproduce
- Install Jython
- Open the interactive interpreter
- 'import appdirs'
- 'appdirs.user_data_dir("anything")'
Output
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\jython2.7.2\Lib\appdirs.py", line 80, in user_data_dir
path = os.path.normpath(_get_win_folder(const))
File "C:\jython2.7.2\Lib\appdirs.py", line 470, in _get_win_folder_from_registry
import _winreg
ImportError: No module named _winreg
Analysis
appdirs attempts to get the Windows folder from ctypes, JNA, and then winreg. However, all 3 are unavailable in a default install of Jython.
Resolutions
Having a final fallback go to os.environ would address this in Jython.
I'll submit a PR with this code in it. (Inspired by #129 ... that PR has conflicts right now, so I'll submit a fresh one.)
Downstream Issues This Resolves
pip: pypa/pip#8806
Metadata
Metadata
Assignees
Labels
No labels