From 8aa307584c1e35dfde114e04ace12b7862579014 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 21 Jun 2009 07:56:05 -0400 Subject: [PATCH] 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. --- libbe/config.py | 2 ++ 1 file changed, 2 insertions(+) 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() -- 2.26.2