diff options
author | makefu <github@syntax-fehler.de> | 2015-08-28 13:53:25 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-08-28 13:53:25 +0200 |
commit | 15026716ab3057998cf2f487742c2dd8e185335c (patch) | |
tree | 8490997c5f426aba8ec35c18f65cda8965cffbce /reaktor/getconf.py | |
parent | c4d5f80b839d8969e99087268fe40e8ac723c629 (diff) |
Reaktor: cleanup
Diffstat (limited to 'reaktor/getconf.py')
-rw-r--r-- | reaktor/getconf.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/reaktor/getconf.py b/reaktor/getconf.py index 168c908..e513e31 100644 --- a/reaktor/getconf.py +++ b/reaktor/getconf.py @@ -1,14 +1,12 @@ -#getconf = make_getconf("dateiname.json") -#getconf(key) -> value -#oder error +#getconf = make_getconf("dateiname.json") +#getconf(key) -> value +#oder error import imp import os def make_getconf(filename): - - def getconf(prop, default_value=None): prop_split = prop.split('.') string = '' @@ -29,5 +27,8 @@ def load_config(filename): dirname = os.path.dirname(filename) modname, ext = os.path.splitext(os.path.basename(filename)) file, pathname, description = imp.find_module(modname, [ dirname ]) - return imp.load_module(modname, file, pathname, description) - + try: + ret = imp.load_module(modname, file, pathname, description) + finally: + if file: file.close() + return ret |