From: W. Trevor King Date: Sun, 21 Jun 2009 11:56:05 +0000 (-0400) Subject: Touch missing userwide config file before read if it's missing. X-Git-Tag: 1.0.0~79 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8aa307584c1e35dfde114e04ace12b7862579014;p=be.git Touch missing userwide config file before read if it's missing. Another bug introduced by James Rowe's user-config patch. Obviously it's hard to read a file if there's no file there. I'm not sure how it passed the unit tests earlier. Maybe I forgot to install the pre-commit version before running the test suite... Anyhow, fixed now. --- diff --git a/libbe/config.py b/libbe/config.py index 9b1682a..e696eeb 100644 --- a/libbe/config.py +++ b/libbe/config.py @@ -37,6 +37,8 @@ def set_val(name, value, section="DEFAULT", encoding=None): if encoding == None: encoding = default_encoding config = ConfigParser.ConfigParser() + if os.path.exists(path()) == False: # touch file or config + open(path(), "w").close() # read chokes on missing file f = codecs.open(path(), "r", encoding) config.readfp(f, path()) f.close()