osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Application Preferences


On 8/19/19 9:22 AM, Malcolm Greene wrote:
> 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
> 
> 
Malcolm,

Thanks for the reply.  I agree that a traditional INI file is the 
easiest way, especially since Python supports them.  So if I understand 
you, your apps look like this:

-App Dir
   |
   +-App Code Folder
      |
      +-(File to direct to home folder)

-Home Folder (the default location, but user can select other locations)
   |
   +-App INI Folder
      |
      +-App INI file