osdir.com


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

preferences file


On Thu, Jan 24, 2019, Dave wrote:
>I'm doing a small application and want to add user preferences.  Did some
>googling to see if there are standard Python ways/tools, but it seems not so
>much.  My specific questions are:
>
>1. Best practices for a user preference file/system?

Generally I put them in the user's $HOME or $HOME/etc directory
with appropriate permissions unless working in a virtual
environement.
>2. File format favored and why - ini, JSON, etc?

I like ini for most user configuration files as the format is
simple, easy to read, and handled nicely with the ConfigParser
libraries.

>3. File location?  I'm using Ubuntu and I believe that the correct location
>would be home/.config/<app-name> .  What about Mac and Windows?

See above.  Same for Mac.  I don't do Windows.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www2.celestial.com/ 6641 E. Mercer Way
Mobile:         (206) 947-5591  PO Box 820
Fax:            (206) 232-9186  Mercer Island, WA 98040-0820

The budget should be balanced, the Treasury should be refilled, public
debt should be reduced, the arrogance of officialdom should be
tempered and controlled, and the assistance to foreign lands should be
curtailed lest Rome become bankrupt. People must again learn to work,
instead of living on public assistance. -- Cicero - 55 BC