Saving/retrieving user preferences

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Wallis

    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,
  • Brian Wallis

    #2
    Re: Saving/retrieving user preferences

    (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...

    Comment

    • Miki Tebeka

      #3
      Re: Saving/retrieving user preferences

      Hello Brian,
      [color=blue]
      > 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?[/color]
      Use internally (almost) any data types you find is best. The save/load is
      using pickle.

      Bye.
      --
      ------------------------------------------------------------------------
      Miki Tebeka <miki.tebeka@zo ran.com>

      The only difference between children and adults is the price of the toys

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

      iD8DBQFCqAWp8jA dENsUuJsRAtzSAJ 98n2BPj2mT63Y2W v4bRVAPmcgqHACg qzRQ
      6kFDg1NjIa+l4PD AZ26yI90=
      =MJOR
      -----END PGP SIGNATURE-----

      Comment

      • Fuzzyman

        #4
        Re: Saving/retrieving user preferences

        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.



        Regards,

        Fuzzy


        Comment

        • bruno modulix

          #5
          Re: Saving/retrieving user preferences

          Brian Wallis wrote:[color=blue]
          > 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?[/color]



          HTH
          --
          bruno desthuilliers
          python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
          p in 'onurb@xiludom. gro'.split('@')])"

          Comment

          • Peter Hansen

            #6
            Re: Saving/retrieving user preferences

            Brian Wallis wrote:[color=blue]
            > 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?[/color]

            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

            Comment

            • flyingfred0

              #7
              Re: Saving/retrieving user preferences

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





              Brian Wallis wrote:[color=blue]
              > 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,[/color]

              Comment

              • Brian Wallis

                #8
                Re: Saving/retrieving user preferences

                Brian Wallis wrote:
                [color=blue]
                > 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).[/color]

                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...

                Comment

                Working...