Skip to content

Unable to execute py"..." after using IPython #33

Description

@kyak

If I run IPython REPL before running any py"..." commands, then py"..." will fail like this:

julia>

In [1]: 1+2
Out[1]: 3

In [2]:

julia> py"1+2"
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/user/.julia/packages/PyCall/ygXW2/src/pyeval.jl:10 =# @pysym(:PyModule_GetDict), PyPtr, (PyPtr,), pyimport("__main__")))))) <class 'SystemError'>
SystemError('Objects/moduleobject.c:468: bad argument to internal function')

Stacktrace:
 [1] pyerr_check
   @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:62 [inlined]
 [2] pyerr_check
   @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:66 [inlined]
 [3] _handle_error(msg::String)
   @ PyCall ~/.julia/packages/PyCall/ygXW2/src/exception.jl:83
 [4] macro expansion
   @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:97 [inlined]
 [5] (::PyCall.var"#115#116"{Module})()
   @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyeval.jl:10
 [6] get!(default::PyCall.var"#115#116"{Module}, h::Dict{Module, PyDict{String, PyObject, true}}, key::Module)
   @ Base ./dict.jl:481
 [7] pynamespace(m::Module)
   @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyeval.jl:7
 [8] top-level scope
   @ ~/.julia/packages/PyCall/ygXW2/src/pyeval.jl:228

If, however, I were to run any py"..." command before running IPython REPL for the first time, it will work fine from there on.

Basically, this forces me to remember to run py"something" or put it in startup.jl, which is not convenient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions