Skip to content

Possible spurious FutureWarning #497

@jolars

Description

@jolars

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions