I'm trying to run a simple python script that takes a json string as an argument in a docker container. However I get the following error:
Traceback (most recent call last):
File "/root/simple.py", line 2, in <module>
import json
ImportError: No module named json
I'm running the standard ubuntu:12.04 image. Here's how I call up the container:
docker run -v $(pwd)/:/root/ ubuntu:12.04 python /root/simple.py '[{"hi":"bye"}]'
My simple.py script is just:
import sys
import json
configs = json.loads(sys.argv[1])
print configs
def read_option_keys(json_file):
json_file[0]["new"] = None
print json.dumps(json_file)
read_option_keys(configs)
Any idea why it's not returning the following as expected:
[{u'hi': u'bye'}]
[{"hi": "bye", "new": null}]
jsonwas added in 2.6.