473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Saving/retrieving user preferences

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
7 2478
(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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Adam J. Schaff | last post by:
OK, there are billions of posts on dotnet newsgroups about this, and I have read half of them, but I'm still a little confused. First I'll say what I think I've learned and anyone can correct me if...
2
by: Nevyn Twyll | last post by:
I understand that I am not supposed to alter the .config file for a program (accessible through the AppSettings). Is there a System class you could recommend that I could use (or even a class...
15
by: Dan DeConinck | last post by:
Hello, I want to save the position of all the controls on my form. I would like to write them out to a preference file. I have done this in DOS BASIC like this: TO WRITE the preference...
0
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
11
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
1
by: Tom | last post by:
I have a large application; lots of forms, multiple dynamic DLLs, etc. I also have, in the appliation, a general 'Preferences' class object (which is in itself a separate DLL, and I just include a...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
1
by: sonic | last post by:
so, profile provider is a way to save application preferenes for each user. the profile can be replaced to provide a different persistance layer, and/or schema, but what about tweaking it to work...
2
by: Tal Shachar | last post by:
Hi, I have a windows application that needs to save some user preferences to an xml and to load it on the next application run. Saving the preferences is done per user. I know that there is a way...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.