[tahoe-dev] tahoemenu.py - ConfigParser write method removes comments?
Garonda Rodian
deepside at hotmail.com
Mon Oct 7 06:12:10 UTC 2013
I've been attempting to start a basic menu system to build grids (test first, then production), and when I try the ConfigParser write method, all of the commented out entries in the tahoe.cfg are removed... I know I'm new to python, so what am I missing?
Snippet (linux based at this time, please assume NodePath is a string and is correct):
config = ConfigParser.RawConfigParser()
TahoeCfg = NodePath + '/tahoe.cfg'
config.read(TahoeCfg)
config.set('node','nickname',GridName)
with open(TahoeCfg,'wb') as configfile:
config.write(configfile)
After that config.write, whether I use RawConfigParser() or SafeConfigParser(), all of the commented out entries that used to be there are wiped out, which I obviously don't want to do. How can I avoid that artifact?
P.S. is it better to put the menu code inline in a message, attach it, or post it somewhere and put in a link?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tahoe-lafs.org/pipermail/tahoe-dev/attachments/20131007/25dfc9bd/attachment.html>
More information about the tahoe-dev
mailing list