JuliaPy / SymPy.jl

Julia interface to SymPy via PyCall
http://juliapy.github.io/SymPy.jl/
MIT License
268 stars 62 forks source link

Displaying Syms giving escaped strings instead of pretty printing #468

Open akriegman opened 2 years ago

akriegman commented 2 years ago

When I try to display symbols in the repl, they get displayed as PyObjects with an escaped string representation, instead of the usual pretty printing. MWE:

julia> @vars x
(x,)

julia> x^2
PyObject ' 2\nx '

I have no idea what I may have done to trigger this. It worked correctly the last time I used SymPy.jl, and it seems like it's supposed to just work out of the box according to the docs. I'm not sure what's supposed to happen normally, but it's not happening.

akriegman commented 2 years ago

I was able to get around this by overriding the show implementation given in SymPy.jl:

Base.show(io::IO, ::MIME"text/plain", s::SymPy.SymbolicObject) =  print(io, pystr(sympy.pretty(s)))

Still, not sure why this happened in the first place.