You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I respect that most bugs are in SymPyCore, but this one looks like a serialization / type error, so maybe it belongs here (happy to move if you think no).
When I tried following a sympy tutorial, I consistently get a type error. Here's the python snippet
fromsympyimportsymbolsfromsympy.solvers.diophantineimportdiophantinex, y, z=symbols("x, y, z", integer=True)
print(diophantine(x**2+y**2-z**2))
I'm trying to learn how to translate python examples to julia. In particulae, I have a little bit of python code:
```python
from sympy import symbols
from sympy.solvers.diophantine import diophantine
x, y, z = symbols("x, y, z", integer=True)
print(diophantine(2*x + 3*y - 5))
ERROR: MethodError: Cannot `convert` an object of type
Tuple{PyCall.PyObject, PyCall.PyObject, PyCall.PyObject} to an object of type
Sym
The function `convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:
Sym(::Tuple)
@ SymPyCore ~/.julia/packages/SymPyCore/Dg45i/src/types.jl:38
Sym(::T) where T
@ SymPyCore ~/.julia/packages/SymPyCore/Dg45i/src/types.jl:30
convert(::Type{T}, ::T) where T
@ Base Base.jl:126
...
Stacktrace:
[1] push!(a::Vector{Sym}, item::Tuple{PyCall.PyObject, PyCall.PyObject, PyCall.PyObject})
@ Base ./array.jl:1260
[2] collect(::Type{Sym}, o::PyCall.PyObject)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/pyiterator.jl:93
[3] ↑(::Type{PyCall.PyObject}, x::PyCall.PyObject)
@ SymPy ~/.julia/packages/SymPy/qBv8D/src/python_connection.jl:52
[4] ↑(x::PyCall.PyObject)
@ SymPyCore ~/.julia/packages/SymPyCore/Dg45i/src/gen_methods.jl:191
[5] (::SymPyCore.SymbolicCallable{PyCall.PyObject})(::Sym{PyCall.PyObject}, ::Vararg{Sym{…}}; kwargs::@Kwargs{})
I have verified that `diophantine` is found as a python callable object. It looks more like an interop issue. But I have no idea what.
I have verified that diophantine is found as a python callable object. It looks more like an interop issue. But I have no idea what.
I even asked on the julia discord and someone else looked at the issue too:
Base.convert(::Type{Sym}, pos::NTuple{N, SymPy.PyCall.PyObject}) where N =Sym(Ref(pos));
we do indeed see a result, which is why they recommended to file an upstream bug. Apparently the result from the diophantine call throws every time (fairly independent of the input).
The text was updated successfully, but these errors were encountered:
Thanks. There are a few ways to handle this. This function returns a python object which is a set of tuples. The conversion of this type wasn't begin picked up properly as the tuple wasn't being converted. That should be fixed now with #562 Let me know if not.
I respect that most bugs are in SymPyCore, but this one looks like a serialization / type error, so maybe it belongs here (happy to move if you think no).
When I tried following a sympy tutorial, I consistently get a type error. Here's the python snippet
and this is my translation to julia:
And I get this error:
and I'm trying to translate it to julia as this:
and I'm getting crashes at the last call:
I have verified that diophantine is found as a python callable object. It looks more like an interop issue. But I have no idea what.
I even asked on the julia discord and someone else looked at the issue too:
https://discord.com/channels/762167454973296644/1341536826501890198
and when they added a type conversion like this:
we do indeed see a result, which is why they recommended to file an upstream bug. Apparently the result from the diophantine call throws every time (fairly independent of the input).
The text was updated successfully, but these errors were encountered: