Python: Problem with parsing e.g. Greek characters with parse_mathematica

Viewed 40

SymPy provides a package, sympy.parsing.mathematica, for parsing Mathematica code. The old parsing function, mathematica, seems to be able to handle e.g. Greek characters fine:

from sympy.parsing.mathematica import mathematica
mathematica('λ')
Out[]: 
λ

As of SymPy v. 1.11, the mathematica function is deprecated, and is replaced by parse_mathematica. This function, however, seems unable to handle the simple example above:

from sympy.parsing.mathematica import parse_mathematica
parse_mathematica('λ')
Traceback (most recent call last):
...

File "<string>", line unknown
SyntaxError: unable to create a single AST for the expression

Any ideas why it doesn't work and what the error message "SyntaxError: unable to create a single AST for the expression" means? Googling on this error message (in quotes) appears to give no hits.

1 Answers

You can use the function symbols() instead, perhaps ?

from sympy import *
symbols('lambda')

 
Related