[IronPython] INI File For IronPython

JoeSox joesox at gmail.com
Tue Oct 2 07:33:38 CEST 2007


On 10/1/07, Davy Mitchell <daftspaniel at gmail.com> wrote:
> Hey Folks,
>
> Just wanted to pick a few brains...
>
> I was working on storage for GUI applications using INI files and
> CPython libs. I am looking to remove the dependency on Python 2 and do
> it all in DotNet. However as far as I can see there is not direct
> support for settings files - at least this is what I gather from all
> the implementations on the web of various XML/registry solutions none
> of which look too polished next to ConfigObj or the Python standard
> lib.
>
> How have other people solved this? Just need the basic name/value pair
> to sart with.

I didn't have too many settings for one app I am working on and I also
wanted to keep it simple as possible.  So I am using the same python
module file that IronPython is importing.  This allows the module to
work in native Python environments (including non Windows OSs) and in
its IronPython GUI.  As long as the features don't change too
drastically all that needs to be updated is the python module.  An
autoupdate feature in its IronPython GUI downloads the new mod and
autobacksup the previous one, just incase.
Feel free to look at pswrdgeniron (IronPython GUI for pswrdgen).
http://www.codeproject.com/useritems/pswrdgeniron.asp
The module opens itself and reads in the first few lines, which each
setting is defined in order on a line.  I used format of
"VARNAME::value" with the value encoded as a string so it is easy to
split and assign to a self.VARNAME. From there it's easy to bridge to
IronPython.
http://joeswammi.com/python/docs/pswrdgen/index.html
-- 
Later, JoeSox



More information about the Ironpython-users mailing list