Application Preferences

Malcolm Greene python at bdurham.com
Mon Aug 19 09:22:53 EDT 2019


Hi Dave,

> The plan for an app that I'm doing was to use SQLite for data and to hold the preference settings as some apps do.  The plan was changed last week to allow the user to select the location of the data files (SQLite) rather than putting it where the OS would dictate.  Ok with that, but it brings up some questions.  First, I will need to have a file that points to the location of the data file  since that can't be hard coded. Second, if I have to have a file that is likely part of the application group of files, would it make more sense to use a more traditional preferences file?  How have other Python app developers done in this case?

We handle the "where is my config file" question by defaulting to script's current directory, then a script-specific folder within their home directory. Users can override that behavior by setting a script specific environment variable or by using a command line switch to point to a different location or config file.

We store our preferences in an INI style config file which we've found easier to support when there's problems.

Malcolm





More information about the Python-list mailing list