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

user_config_dir vs Python from MS Store? #160

Open
krystian3w opened this issue Feb 1, 2021 · 1 comment
Open

user_config_dir vs Python from MS Store? #160

krystian3w opened this issue Feb 1, 2021 · 1 comment

Comments

@krystian3w
Copy link

krystian3w commented Feb 1, 2021

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)

@tijmenbaarda
Copy link

tijmenbaarda commented May 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants