type=dict in argparse.add_argument()
<p>I'm trying to set up a dictionary as optional argument (using argparse); the following line is what I have so far:</p>

<pre><code>parser.add_argument('-i','--image', type=dict, help='Generate an image map from the input file (syntax: {\'name\': &lt;name&gt;, \'voids\': \'#08080808\', \'0\': \'#00ff00ff\', \'100%%\': \'#ff00ff00\'}).')
</code></pre>

<p>But running the script:</p>

<pre><code> $ ./script.py -i {'name': 'img.png','voids': '#00ff00ff','0': '#ff00ff00','100%': '#f80654ff'}

script.py: error: argument -i/--image: invalid dict value: '{name:'
</code></pre>

<p>Even though, inside the interpreter,</p>

<pre><code>&gt;&gt;&gt; a={'name': 'img.png','voids': '#00ff00ff','0': '#ff00ff00','100%': '#f80654ff'}
</code></pre>

<p>works just fine.</p>

<p>So how should I pass the argument instead?
Thanks in advance.</p>
