[Baypiggies] Reading k=v format files

Ian Zimmerman itz at buug.org
Sat Oct 3 22:04:35 CEST 2015


On 2015-10-03 12:09 -0700, David Berthelot wrote:

> The module ConfigParser in the standard library could be of help since it
> seems to do exactly this:
> https://docs.python.org/2/library/configparser.html

Sadly, no.

$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ConfigParser as CP
>>> p=CP.RawConfigParser()
>>> p.read('auth')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/ConfigParser.py", line 305, in read
    self._read(fp, filename)
  File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section
headers.
file: auth, line: 1

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.


More information about the Baypiggies mailing list