-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiline evaluation #210
Comments
You can do pyeval("""
x = 2
y = 3
print(x + y)
""") and similar with |
Yes, thanks that's exactly what I meant. I was using the |
In fact I am getting using PythonCall
pyeval("""
x = 2
y = 3
print(x + y)
""") ERROR: LoadError: MethodError: no method matching pyeval(::String)
Closest candidates are:
pyeval(::Any, ::Any) at ~/.julia/packages/PythonCall/d8Xcl/src/concrete/code.jl:47
pyeval(::Any, ::Any, ::Any) at ~/.julia/packages/PythonCall/d8Xcl/src/concrete/code.jl:47
pyeval(::Type{T}, ::Any, ::Any) where T at ~/.julia/packages/PythonCall/d8Xcl/src/concrete/code.jl:41 using PythonCall
pyeval("""
x = 2
y = 3
print(x + y)
""", Main) ERROR: LoadError: Python: SyntaxError: invalid syntax (<string>, line 1)
Python stacktrace: none
Stacktrace:
[1] pythrow()
@ PythonCall ~/.julia/packages/PythonCall/d8Xcl/src/err.jl:94
[2] errcheck
@ ~/.julia/packages/PythonCall/d8Xcl/src/err.jl:10 [inlined]
[3] pycallargs(f::Py, args::Py)
@ PythonCall ~/.julia/packages/PythonCall/d8Xcl/src/abstract/object.jl:210
[4] pycall(::Py, ::String, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ PythonCall ~/.julia/packages/PythonCall/d8Xcl/src/abstract/object.jl:228
[5] pycall
@ ~/.julia/packages/PythonCall/d8Xcl/src/abstract/object.jl:218 [inlined]
[6] #_#13
@ ~/.julia/packages/PythonCall/d8Xcl/src/Py.jl:358 [inlined]
[7] Py
@ ~/.julia/packages/PythonCall/d8Xcl/src/Py.jl:358 [inlined]
[8] pyeval(::Type{Py}, code::String, globals::Module, locals::Nothing)
@ PythonCall ~/.julia/packages/PythonCall/d8Xcl/src/concrete/code.jl:43
[9] pyeval (repeats 2 times)
@ ~/.julia/packages/PythonCall/d8Xcl/src/concrete/code.jl:47 [inlined] |
Sorry I was mistaken. It's |
I think this is resolved. |
Thanks @cjdoris it works as intended! |
Hi,
I am wondering if there is any API for multiline python code evaluation? I have gone through the documentation but was not able to find a clear example of this use case. Thank you for the help!
The text was updated successfully, but these errors were encountered: