pyjulia icon indicating copy to clipboard operation
pyjulia copied to clipboard

Possible spurious FutureWarning

Open jolars opened this issue 3 years ago • 0 comments

Please consider this code:

from julia import Julia

jl = Julia()
jl.eval("1 + 1")
#> [...]/.pyenv/versions/3.9.10/lib/python3.9/site-packages/julia/core.py:703: FutureWarning: Accessing `Julia().<name>` to obtain Julia objects is deprecated.  Use `from julia import Main; Main.<name>` or `jl = Julia(); jl.eval('<name>')`.
#>   warnings.warn(
#> 2

I don't understand why there's an error here since I'm in fact using one of the recommended options from the warning above.

Using the first option works fine however:

from julia import Main

Main.eval("1 + 1")
#> 2

jolars avatar May 10 '22 14:05 jolars