wxFileConfig Path

My wxPython Windows application keeps its data in a wxFileConfig object. The vibes I get are that the community prefers to keep user-specific data in the registry instead of a text file, but text files suit me best since I can peek at them without running any additional program and I can delete them in one fell swoop without fear that I may have accidentally tucked data in a place that I did not intend.

REGARDLESS, I am creating my object with:

APP_NAME = “Coyote IDE”
VENDOR_NAME = “Coyote DataCom”
LOCAL_FN = “CoyoteIDE.cfg”
.

:

S = wx.FileConfig(APP_NAME, VENDOR_NAME, LOCAL_FN)

This works fine, but it’s putting my configuration file at:

C:\Documents and Settings<user>\CoyoteIDE.cfg

which isn’t quite what I’d expect. Wouldn’t:

C:\Documents and Settings<user>\Local Settings\Application Data\Coyote DataCom\CoyoteIDE.cfg

be a more logical? Did I miss something or am I not constructing my object correctly?

Thanks,

Gre7g

Gre7g Luterman wrote:

My wxPython Windows application keeps its data in a wxFileConfig object. The vibes I get are that the community prefers to keep user-specific data in the registry instead of a text file, but text files suit me best since I can peek at them without running any additional program and I can delete them in one fell swoop without fear that I may have accidentally tucked data in a place that I did not intend.
*REGARDLESS*, I am creating my object with:
APP_NAME = "Coyote IDE"
VENDOR_NAME = "Coyote DataCom"
LOCAL_FN = "CoyoteIDE.cfg"
.
:
S = wx.FileConfig(APP_NAME, VENDOR_NAME, LOCAL_FN)
This works fine, but it's putting my configuration file at:
C:\Documents and Settings\<user>\CoyoteIDE.cfg
which isn't quite what I'd expect. Wouldn't:
C:\Documents and Settings\<user>\Local Settings\Application Data\Coyote DataCom\CoyoteIDE.cfg
be a more logical? Did I miss something or am I not constructing my object correctly?
Thanks,
Gre7g
------------------------------------------------------------------------

I've never used that. I always use wx.StandardPaths. Something like this:

paths = wx.StandardPaths.Get()
paths.GetUserDataDir()

See the demo for the other methods.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Hey! That’s a pretty simple solution. Here’s a test snippet for anyone curious:

···

On Wed, Oct 29, 2008 at 11:43 AM, Mike Driscoll mike@pythonlibrary.org wrote:

I’ve never used that. I always use wx.StandardPaths. Something like this:

paths = wx.StandardPaths.Get()

paths.GetUserDataDir()

============================

#!/usr/bin/python

import wx
import os

APP_NAME = “Coyote IDE”
VENDOR_NAME = “Coyote DataCom”
LOCAL_FN = “CoyoteIDE.cfg”

A = wx.PySimpleApp()
A.SetAppName(VENDOR_NAME)

ULDD = wx.StandardPaths.Get().GetUserLocalDataDir()
if not os.path.isdir(ULDD):
os.mkdir(ULDD)
DataPath = “%s/%s” % (ULDD, APP_NAME)
if not os.path.isdir(DataPath):
os.mkdir(DataPath)

FilePath = “%s/%s” % (DataPath, LOCAL_FN)
F = wx.FileConfig(localFilename=FilePath)

F.SetPath(“APath”)
print F.Read(“Key”)
F.Write(“Key”, “Value”)
F.Flush()

=============================

Thanks,

Gre7g