diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-19 03:26:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-19 03:32:23 +0400 |
commit | 2a9e33fba56c0d99aa224c91860be25783363ad5 (patch) | |
tree | 3d6d2f0d9fa10f2fb662d644f159d531a3aa2d2d /release/scripts/modules/bpy | |
parent | 7afbdbf812abd172cc4dd67c16b540a6510a38f1 (diff) |
Keymap: load/save improvements
- avoid passing redundant operator name to keymap property set function.
- avoid double attr lookups when setting each property.
- handle exceptions on value type mismatch.
- avoid resource warning on failed load.
Diffstat (limited to 'release/scripts/modules/bpy')
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 608cd920865..6c32f95fc03 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -494,10 +494,10 @@ def keyconfig_set(filepath, report=None): keyconfigs_old = keyconfigs[:] try: - keyfile = open(filepath) - exec(compile(keyfile.read(), filepath, "exec"), {"__file__": filepath}) - keyfile.close() error_msg = "" + with open(filepath, 'r', encoding='utf-8') as keyfile: + exec(compile(keyfile.read(), filepath, "exec"), + {"__file__": filepath}) except: import traceback error_msg = traceback.format_exc() |