S
S
Sergey Aganezov2011-08-13 20:15:55
Python
Sergey Aganezov, 2011-08-13 20:15:55

Python application and settings storage

Description



There is an application which is written on Python. Language version 2.7.2. SQLite 3 is used as an information storage, and, accordingly, the library built into the language is used to work with this database. It is necessary that the application run under three main platforms: Windows XP and above; Mac OS 10.6 and above; Ubuntu.

Problem



You need to have a settings file for this application. Moreover, it seems to me that there should be at least 2 sets of settings (default and users), but since there can be many users, it would be nice if everyone had settings that allow him to work with the application in a convenient mode. What are the options for storing such information in the project? What approaches to the implementation of such functionality are most preferable? Maybe you can read something about it - then I will be glad to provide sources of information.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Gosha Arinich, 2011-08-13
@goshakkk_reborn

On OS X, it is better to store the settings in a plist, while ~/Library/Preferences/com.author.app_name.plistPython can work with plists.

A
anatoly_rr, 2011-08-28
@anatoly_rr

It's amazing how this Q&A is similar to this one ! Almost all the authors and the content of the answers are the same! The first answer is a link to the library, the second is about OS X and a note about unnecessary complication, the third is about native / Pythonic, and the fourth is about similarity!

K
Konstantin, 2011-08-13
@Norraxx

docs.python.org/library/configparser.html

V
Vladimir Chernyshev, 2011-08-13
@VolCh

You can store user settings (at least the sqlite file itself, if data sharing between users is not required) in the os.path.join(site.getuserbase(), 'appname') directory, but this does not look quite native in Windows. Here is a platform-independent solution how to get the path to the default settings I don’t know. Probably, nevertheless, it is necessary to analyze the platform (differences are at least *nix, WinNT <6.0 and >=6.0) and store settings and data in general in accordance with OS guides.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question