From: Fuzzyman <fuz...@vo...> - 2005-12-07 09:34:20
|
Holt, Patrick wrote: > Michael, > > Finally found your email address. I prefer to use the fuz...@vo... address. The other one has become unreliable. The configobj-develop mailing list is a good way to get hold of me as well. > We've integrated configObj into our program and it works great. > Fantastic. Is it public ? Anything I can link to (or quote) in the ConfigObj use cases (even if the project isn't public) ? I'm not offended if the answer is no. ;-) > One question; Are there any escape characters I can use to > get configOby to ignore certain characters i.e. the # sign. > I use this in a comment I store as part of a multi line header > but configObj complains when it picks up the second line, does not like > it. > I've tried quotes around it but treats it as one long string instead of > a list of strings. Thoughts? > > Regards, > > Patrick > > Ie. > > headerTemplate = > ["#*************************************************", > "# ", > "# SVE Automatic configuration file", > "# ", > "# System : %s", > "# Version : %s", > "# ", > "# Input file name : %s", > "# ", > "# Generation Date : %s", > "# ", > "# Notes: ", > "# ", > "# ", > > "#*************************************************", > " " ] > I don't really understand I'm afraid. ConfigObj *already* treats lines that begin with '#' as a comment. Using your example : >>> headerTemplate = ["#*************************************************", ... "# ", ... "# SVE Automatic configuration file", ... "# ", ... "# System : %s", ... "# Version : %s", ... "# ", ... "# Input file name : %s", ... "# ", ... "# Generation Date : %s", ... "# ", ... "# Notes: ", ... "# ", ... "# ", ... ... "#*************************************************", ... " " ] >>> a = ConfigObj(headerTemplate) >>> a {} >>> a.initial_comment ['#*************************************************', '# ', '# SVE Automatic configuration file', '# ', '# System : %s', '# Version : %s', '# ', '# Input file name : %s', '# ', '# Generation Date : %s', '# ', '# Notes: ', '# ', '# ', '#*************************************************', ' '] >>> ConfigObj parses the lines above as all being comment, and preserves it as the ``initial_comment`` attribute. Note that this example caused me to uncover a (very minor) bug - in versions of ConfigObj before 4.0.3 (which is about to be released). A config file which is *all* comments (like the one above) would have the comment as ``final_comment`` rather than ``initial_comment``. :-) Does this answer your question, Patrick ? It's possible I still don't understand your need. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > > -----Original Message----- > From: Michael Foord [mailto:mi...@pc...] > Sent: Monday, August 01, 2005 4:20 AM > To: Holt, Patrick > Subject: New Config File Format > > Hello Patrick, > > I hope you had a good weekend. > > Nicola Larosa has made the next set of changes to ConfigObj - so the > nested section format has now changes. The tests and the docs have been > updated to reflect this. > > You can pull the updated module and docs out of SVN at : > http://svn.rest2web.python-hosting.com/branches/configobj4/ > > If you have any further questions, feel free to ask. > > Best Regards, > > Michael Foord > http://www.voidspace.org.uk/python > > > |