Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install configdict

How to install configdict

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install configdict
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
20101116.1 Available View build log
20100729.2 Available View build log
Windows (64-bit)
20101116.1 Available View build log
20100729.2 Available View build log
Mac OS X (10.5+)
20101116.1 Available View build log
20100729.2 Available View build log
Linux (32-bit)
20101116.1 Available View build log
20100729.2 Available View build log
Linux (64-bit)
20101116.1 Available View build log
20100729.2 Available View build log
 
License
GPL
Depended by
Imports
Lastest release
version 20101116.1 on Jan 5th, 2011

configdict: parse INI files into Python dictionaries

configdict parses INI-style configuration files into Python dictionaries. Given a file like this:

[DEFAULT]

in stock = yes

[widgets]

price = 110.00 size = large

options = this that and the other thing

You can do this:

>>> import configdict
>>> cf = configdict.ConfigDict('sample.conf')

And get this:

>>> import pprint
>>> pprint.pprint(cf)

System Message: ERROR/3 (<string>, line 30)

Inconsistent literal block quoting.

{'DEFAULT': {'in stock': 'yes'}, '__GLOBAL__': {}, 'widgets': {'options': 'this that and the other thing', 'price': '110.00', 'size': 'large'}}

And do this:

>>> print cf['widgets']['in stock']

System Message: ERROR/3 (<string>, line 39)

Inconsistent literal block quoting.

yes

editini script

The editini script included in recent versions of configdict allows you to edit ini-style configuration files "on the fly". The script supports the following options:

-g GROUP, --group=GROUP -v VALUE, --value=VALUE -d DELETE, --delete=DELETE -D, --delete-group

These options allow you to add, modify, or remote items from a configuration file. For example, you can do this:

$ editini -g widgets \

System Message: ERROR/3 (<string>, line 57)

Inconsistent literal block quoting.

-v 'comment=These are great!' -d options < sample.conf

And get this:

[DEFAULT]

System Message: ERROR/3 (<string>, line 63)

Inconsistent literal block quoting.

in stock = yes

[widgets] comment = These are great! price = 110.00 size = large

Or you delete entire sections:

$ editini -g widgets -D < sample.conf [DEFAULT] in stock = yes

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.