Use subprocess.check_output
to get the output from that script in a string and then apply ast.literal_eval
to that string to get the dict object.
import ast
import subprocess
ret = subprocess.check_output(['python','some_script.py'])
dic = ast.literal_eval(ret)
ast.literal_eval
demo:
>>> ret = "[{'itemkey1': 'item1', 'itemkey2': 'item2'}, {'itemkey1': 'item1', 'itemkey2': 'item2'}]\n"
>>> ast.literal_eval(ret)
[{'itemkey2': 'item2', 'itemkey1': 'item1'}, {'itemkey2': 'item2', 'itemkey1': 'item1'}]
help on ast.literal_eval: literal_eval(node_or_string)
Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None.