chpwd, config.py: Don't fail if there's no configuration file.
[chopwood] / config.py
index 2c13232..bb7b32b 100644 (file)
--- a/config.py
+++ b/config.py
@@ -26,6 +26,7 @@
 from __future__ import with_statement
 
 import os as OS; ENV = OS.environ
+import output as O; OUT = O.OUT
 import sys as SYS
 import types as TY
 
@@ -81,8 +82,12 @@ def loadconfig(config):
   d.update(DEFAULTS)
 
   ## And run the configuration code.
-  with open(config) as f:
-    exec f in d
+  try:
+    with open(config) as f:
+      exec f in d
+  except IOError, e:
+    OUT.warn("couldn't open configuration file `%s': %s" %
+             (config, e.strerror))
 
   ## Run the hooks.
   for func in _HOOKS: