Config directory issue

In trying to work with wxPython to make up a small utility which I can port between Windows & Mint, I have run into a curious issue when I try to construct a directory path for my config data.

Under Windows, my usual location is %AppData%\appname
Under Mint/Linux I am using ~/home/user/.appname/

Under both systems I work in VSCode to build and debug.

In my main apps init section, I try to obtain the base path for my config directory with:

        stdPth = wx.StandardPaths.Get()
        # use the same path for all needs to ensure consistency
        test = stdPth.GetUserDataDir()
        if wx.Port == '__WXMSW__':
            configDir = os.path.join(stdPth.GetUserConfigDir(),  gl.globAppName )
        elif wx.Port == '__WXGTK__':
            configDir = stdPth.GetUserDataDir()
            configDir = ""
        gl.globIniFileDir  = configDir
        if not os.path.exists(configDir):

For both systems, this gives me the path I expect:
and I confirm this with print statements as the path is constructed and used.
All of this works well enough under Mint 21.2, but when I execute the code under Win 11, either from the command line using python .\ in the working directory or from within VSCode,
the directory in which the INI file ends up in is:

While for the time being, I can work around this since I know where to look for my files, It will be very frustrating in the long run.

As it is, I cannot blame wxPython for this issue, but this forum seems to be the most likely place to get help.
FWIW, under Mint, I am running in a virtual environment, but not under Windows, as that did not seem necessary.

it looks as though wx here makes a suggestion where files should be (in the demo all of them are shown)
but for Python it doesn’t matter as long as they can be reached at run time (on my Windows there is no difference between 3.10 and 3.11 with wx.StandardPaths) :woozy_face:

FWIW, installing Python 3.9 on my system and re-installing all of the dependencies for my app, resolved the problem and my INI file is now created where I expected it.

@da-dada it is not the paths returned by wx.StandardPaths that is/was the problem, it was what the python interpreter seems to do ‘under the hood’ and out of sight.

A bit more detail: On my Win machine I had two very similar wxPython apps, with identical code to handle my INI file and when I use the python 3.10 interpreted the INI files and up off in a corner of the interpreter path, but when I run things using the 3.9 interpreter, the files end up in the expected place.

First of all I have not used Windows for about 10 years so I have no direct experience.

However, I came across this post which describes what sounds like a similar situation.

The reply to that question states that the problem is due to the “app distribution from the Microsoft Store, which is sandboxed to some extent in terms of appdata and registry locations”.

Did you install Python 3.10 from the Microsoft Store?

using the store is a trap (I think the launcher is missing as well) :laughing:

Thank you for that pointer.

Yes, it looks like my Python 3.10 was from the MS Store and I have now removed it on my Windows PC, although I have not run any test since I intend to stick with 3.9 for a bit