Created
December 11, 2012 11:16
-
-
Save anonymous/4257865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConfigParser: | |
http://docs.python.org/2/library/configparser.html | |
>>> from ConfigParser import RawConfigParser as ConfigParser | |
>>> ConfigParser().read('test.conf') | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/usr/lib64/python2.7/ConfigParser.py", line 305, in read | |
self._read(fp, filename) | |
File "/usr/lib64/python2.7/ConfigParser.py", line 546, in _read | |
raise e | |
ConfigParser.ParsingError: File contains parsing errors: test.conf | |
[line 2]: ' rabbit_password = openstack\n' | |
iniparse: | |
http://code.google.com/p/iniparse/ | |
>>> from iniparse import INIConfig | |
>>> INIConfig(open('test.conf')) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/usr/lib/python2.7/site-packages/iniparse/ini.py", line 471, in __init__ | |
self._readfp(fp) | |
File "/usr/lib/python2.7/site-packages/iniparse/ini.py", line 641, in _readfp | |
raise exc | |
ConfigParser.ParsingError: File contains parsing errors: test.conf | |
[line 2]: rabbit_password = openstack | |
configobj: | |
http://www.voidspace.org.uk/python/configobj.html#the-config-file-format | |
>>> from configobj import ConfigObj | |
>>> ConfigObj('test.conf') | |
ConfigObj({'DEFAULT': {'rabbit_password': 'openstack'}}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment