By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

Saving/retrieving user preferences

P: n/a
This may be a FAQ,but I cannot find it.

I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?

thanks,
Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
(my last post seemed to not get out, sorry if you see it twice)

This may be a FAQ,but I cannot find it.

I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?

thanks,

--
brian...

Jul 19 '05 #2

P: n/a
Hello Brian,
I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?

Use internally (almost) any data types you find is best. The save/load is
using pickle.

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <mi*********@zoran.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCqAWp8jAdENsUuJsRAtzSAJ98n2BPj2mT63Y2Wv4bRV APmcgqHACgqzRQ
6kFDg1NjIa+l4PDAZ26yI90=
=MJOR
-----END PGP SIGNATURE-----

Jul 19 '05 #3

P: n/a
ConfigObj is a nice way of reading/writing text config files.

It's case insensitive and handles quoting of keywords/values.

Reading and writing config files are single line commands.

You get access to keyword values using a dicitionary interface.

Values can be single values or lists (including nested lists if you
want).

Lots of other options.

http://www.voidspace.org.uk/python/configobj.html

Regards,

Fuzzy
http://www.voidspace.org.uk/python/

Jul 19 '05 #4

P: n/a
Brian Wallis wrote:
This may be a FAQ,but I cannot find it.

I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?


http://docs.python.org/lib/module-ConfigParser.html

HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Jul 19 '05 #5

P: n/a
Brian Wallis wrote:
This may be a FAQ,but I cannot find it.

I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?


As you can see from the replies so far, there is no 'standard', if by
that you mean "one single widely used solution". There are a dozen ways
to do it, with (as far as I can tell) no one standing out in popularity.

That said, I believe the ConfigParser approach is probably one of the
best combinations of simplicity and cleanliness.

-Peter
Jul 19 '05 #6

P: n/a
If you're creating your GUI with wxPython, you might be able to use
wx.Config and related classes.

http://wxpython.org/docs/api/wx.ConfigBase-class.html

Brian Wallis wrote:
This may be a FAQ,but I cannot find it.

I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).

Is there a 'standard' package for doing this in python?

thanks,

Jul 19 '05 #7

P: n/a
Brian Wallis wrote:
I want to save user preferences, window sizes, recently opened file names,
etc for a python application and I am looking for a package that does this
in a way that is portable across unix/linux and windows (and mac would be
nice as well).


Thank you all for the replies. I have a few options to try now. I'm using
wxPython so might investigate wxConfigBase for a start.

thansks,
--
brian...

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.