ConfigParser is not parsing

Rolando Espinoza La Fuente darkrho at gmail.com
Sat Feb 13 03:28:32 CET 2010


read() does not return the config object

>>> import ConfigParser
>>> config = ConfigParser.SafeConfigParser()
>>> config.read('S3Files.conf')
['S3Files.conf']
>>> config.sections()
['main']
>>> config.get('main', 'taskName')
'FileConfigDriver'

Regards,

Rolando Espinoza La fuente
www.rolandoespinoza.info



On Fri, Feb 12, 2010 at 10:18 PM, felix gao <gre1600 at gmail.com> wrote:
> Hi all,
> I am trying to get the some configuration file read in by Python, however,
> after the read command it return a list with the filename that I passed in.
> what is going on?
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import ConfigParser
>>>> p = ConfigParser.SafeConfigParser()
>>>> cfg = p.read("S3Files.conf")
>>>> cfg
> ['S3Files.conf']
>
>  cat S3Files.conf
> [main]
> taskName=FileConfigDriver
> lastProcessed=2010-01-31
> dateFromat=%Y-%m-%d
> skippingValue=86400
> skippingInterval=seconds
> Thanks in advance.
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>



More information about the Python-list mailing list