Open krystian3w opened 3 years ago
I had the same issue recently when I was testing an application that uses appdirs
on Windows on a Python version from the Microsoft Store. The value of AppDirs.user_data_dir
is a short value:
C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
But if you actually save files to this path, the files will end up somewhere else:
C:\Users\<username>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11<...>\LocalCache\Local\<AppAuthor>\<AppName>
This seems to be the result of some type of reparse points (see link below). This is normally not a problem, because apparently this transformation is done in the background by the operating system and not visible at all in Python. However, if you want to show this directory to the user (and this is what my application did) the wrong directory will be shown and that can cause a lot of confusion.
The actual path can easily be found using pathlib
:
from pathlib import Path
Path(AppDirs('app', 'org').user_data_dir).resolve(strict=True)
However, that only works if the directory has already been created.
I am not sure if this can be solved somehow, but perhaps some note in the documentation would be useful.
See also here: https://youtrack.jetbrains.com/issue/PY-33406/Allow-using-Python-interpreter-from-Windows-Store
How detect where Python form MS Store have
user_config_dir
?On my PC I found these folder:
AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\Local\
But in console see false localisation:
AppData\Local
(no more folders created)