Can't use sympy parser in my class; TypeError : 'module' object is not callable
<p>I wrote some code for calculating the differential equation and it's solution using sympy, but I'm getting an error, my code : ( example )</p>

<pre><code>from sympy.parsing import sympy_parser
expr=1/2
r='3/2'
r=sympy_parser(r)
</code></pre>

<p>I get </p>

<pre><code>TypeError: 'module' object is not callable
</code></pre>

<p>What am I doing wrong here ?</p>

<p><code>sympy_parser</code> is a <em>module</em>, and modules are not a <em>callable</em>. What you want is <a href="http://docs.sympy.org/dev/modules/parsing.html" rel="nofollow"><code>sympy_parser.parse_expr</code></a>:</p>

<pre><code>&gt;&gt;&gt; from sympy.parsing import sympy_parser
&gt;&gt;&gt; r ='3/2'
&gt;&gt;&gt; r = sympy_parser.parse_expr(r)
&gt;&gt;&gt; r
3/2
</code></pre>

python python-3.x sympy