[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: ConfigParser is not parsing

Rolando Espinoza La Fuente

2/13/2010 2:29:00 AM

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@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/p...
>
>