chiark
/
gitweb
/
~mdw
/
chopwood
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chpwd, config.py: Don't fail if there's no configuration file.
[chopwood]
/
config.py
diff --git
a/config.py
b/config.py
index 2c13232c6e896a94d36c1a3bc98a5faec20605e8..bb7b32befc21bb0d21f0bb4831394a12e6f9f635 100644
(file)
--- a/
config.py
+++ b/
config.py
@@
-26,6
+26,7
@@
from __future__ import with_statement
import os as OS; ENV = OS.environ
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
import sys as SYS
import types as TY
@@
-81,8
+82,12
@@
def loadconfig(config):
d.update(DEFAULTS)
## And run the configuration code.
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:
## Run the hooks.
for func in _HOOKS: