[Tutor] config file parsing problem. (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Sep 5 11:05:07 EDT 2003


Hi Thomi,


I've got to forward this to Tutor; I'll take a look later on in the day,
when things aren't so hectic for me... *grin*

Talk to you later!


---------- Forwarded message ----------
Date: Fri, 5 Sep 2003 21:14:46 +1200
From: Thomi Richards <thomi at imail.net.nz>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] config file parsing problem.

On Fri, 05 Sep 2003 11:10, Danny Yoo wrote:
Hi,

> Are you commenting individual options?  And how are comments "attached" to
> the key-value pairs?  On the same line, or on top?  Perhaps ConfigParser
> could be extended to preserve comments that are attached to certain
> options.
>

No, comments are over several lines, and are above the actual lines themselfs.
here's an excerpt from the file:

---
#
# The debug option can be set to an integer value. If debug is 0, debugging
statements will not get
# to the console. otherwise, they will

debug = 1

#
# verbosity isn't currently implimented, but it will controll how much
information is printed to the
# apps main outwindow.
#

verbosity = 3

---

some comment sections span over 10 lines.


>
> Tell us a little more about the problem, and perhaps we can see if
> ConfigParser can be enhanced to do it.
>

Well, I currently have a main app, which imports a module I have created
called "config". At the moment, the config module opens the config file, and
reads in, line by line from the file. If the current line is not a file, it
processes it accordingly..


The reason I had not used configparser previously was simply because I had not
bothered to learn it, and it seemed a little too complex for what I was
looking for (and it never mentioned anything about comments ;)).


Thanks,
-- 
Thomi Richards,
http://once.sourceforge.net/







More information about the Tutor mailing list