aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index acc9ec0f6..1e23a89c4 100644
--- a/utils.py
+++ b/utils.py
@@ -890,3 +890,14 @@ def memoize(function):
memo[args] = rv
return rv
return wrapper
+
+def get_python_dict(python_script_path):
+ try:
+ with open(python_script_path) as f:
+ python_dict = {}
+ code = compile(f.read(), python_script_path, 'exec')
+ exec(code, {}, python_dict)
+ return python_dict
+ except IOError as e:
+ print("get_python_dict: Couldn't get dict from python file: {}.".format(python_script_path))
+ raise