Hello list,
I had asked this over in wxpython-users, but it seems to have hit a dead-end. I’m joining the dev list to try again, because it might be more appropriate. I hope this is okay.
According to the freedesktop spec, see *, typical user data and config paths should be:
XDG_DATA_HOME = ~/.local/share/
XDG_CONFIG_HOME = ~/.config/
I
am testing wxPython 4 in a “venv” (python3 -m venv etc.) wherein I used
pip to install wxPython on Ubuntu 16.04
Looking into wx.StandardPaths, I find:
(test1) donn@ddm:~/…/test1/bin$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
import wx
app=wx.App()
sp=wx.StandardPaths.Get()
sp.GetUserDataDir()
‘/home/donn/.python’
(I dunno what this is. I’ve never seen a ~/.python directory!)
sp.GetConfigDir()
‘/etc’
(Okay, I’m thinking this might be a root thing. Fair enough.)
sp.GetUserLocalDataDir()
‘/home/donn/.python’
(I expect “/home/donn/.local/share” here.)
sp.GetUserConfigDir()
‘/home/donn’
(I expect “/home/donn/.config” here.)
sp.GetLocalDataDir()
‘/etc/python’
(I don’t understand this one either.)
I cannot seem to find the strings that agree with the spec paths as per XDG_DATA_HOME and XDG_CONFIG_HOME.
I tried wxPython’s demo of StandardPaths, with no better results. There are a lot of nice variables that hint at what I want, but they all return strange paths.
It’s
rather NB for my app to get the Linux paths right. I need to reach into
the ~/.config/fontconfig/ directory – which can’t be a hard-coded string.
Currently, I’m using GLib (the “python-gi” package) to fetch the XDG paths, which is another dependency. It feels like it should not be necessary because the “stack”, in my case, goes:
wxPython → wx → (GTK + GLib + et al.). Meaning GLib is already there, under the surface. I would think it could make the correct paths available upwards. Perhaps wx is not doing the right XDG thing?
Any ideas? Am I doing something dumb?