2

I wrote some code for calculating the differential equation and it's solution using sympy, but I'm getting an error, my code : ( example )

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

I get

TypeError: 'module' object is not callable

What am I doing wrong here ?

zivo
  • 120
  • 8
  • It's because module objects are not callable. Maybe you wanted `sympy.sympify(r)` instead. – wim Oct 13 '16 at 16:06

1 Answers1

2

sympy_parser is a module, and modules are not a callable. What you want is sympy_parser.parse_expr:

>>> from sympy.parsing import sympy_parser
>>> r ='3/2'
>>> r = sympy_parser.parse_expr(r)
>>> r
3/2
Moses Koledoye
  • 77,341
  • 8
  • 133
  • 139