pass dictionary as command line argument
<p>FILE - <strong>a.py</strong></p>

<pre><code>import os
toolObj = {
    'CLIENT_IP': u'10.193.xyz.xyz',
    'CMD_KEY': 8000,
    'CMD_WD': None,
    'CMD': u'date',
    'NUM_INSTANCE': '',
    'DURATION': -1,
    'TIME_OUT': '',
    'PORT': '',
    'CNFG_PARAM': '',
    'MSG_TYPE': '',
    'NUM_ITER': '',
    'CMD_HASH': '1475212'
}
print os.popen('python b.py %s'%toolObj).read()
</code></pre>

<p>FILE - <strong>b.py</strong></p>

<pre><code>import sys, ast&lt;br&gt;
print sys.argv
toolObj = ast.literal_eval(sys.argv[1])
print 'using ast', toolObj
</code></pre>

<p>On executing <code>a.py</code> i get the following error:</p>

<pre><code>Traceback (most recent call last):
File "96_.py", line 16, in 
toolObj = ast.literal_eval(sys.argv[1])
File "/usr/local/lib/python2.7/ast.py", line 49, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/usr/local/lib/python2.7/ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 1
{CLIENT_IP:
^ SyntaxError: unexpected EOF while parsing
['96_.py', '{CLIENT_IP:', 'u10.193.xyz.xyz,', 'CMD_KEY:', '8000,', 'CMD_WD:', 'None,', 'CMD:', 'udate,', 'NUM_INSTANCE:', ',', 'DURATION:', '-1,', 'TIME_OUT:', ',', 'NUM_ITER:', ',', 'CNFG_PARAM:', ',', 'MSG_TYPE:', ',', 'PORT:', ',', 'CMD_HASH:', '1475212}']
</code></pre>

<p>I have tried <code>json</code> &amp; <code>cPickle</code> both did not work.</p>