Skip to content
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

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

Open
kyak opened this issue Jan 9, 2023 · 0 comments
Open

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

kyak opened this issue Jan 9, 2023 · 0 comments

Comments

@kyak
Copy link

kyak commented Jan 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant