JuliaPy / JuliaPy/PyPlot.jl

exception after closing the window

未关闭
#459 6 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
488
派生
90
PR 合并指标
30 天内没有已合并 PR

描述

The script is like this:
```julia
# plot.jl
using PyPlot

plot([2,4], [3,8])
show()
```
and then I run the script in a terminal.
It shows a window displaying the plot. Everything is fine until the window is closed.

The error message is the following:
```julia
ERROR: LoadError: PyError ($(Expr(:escape, :(ccall(#= /home/mine/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)))))
TypeError('signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object')
File "/usr/lib/python3.7/site-packages/matplotlib/pyplot.py", line 269, in show
return _show(*args, **kw)
File "/usr/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py", line 413, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3302, in show
cls.mainloop()
File "/usr/lib/python3.7/site-packages/matplotlib/backends/backend_qt5.py", line 1099, in mainloop
signal.signal(signal.SIGINT, old_signal)
File "/usr/lib/python3.7/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))

Stacktrace:
[1] pyerr_check at /home/mine/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/mine/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
[3] macro expansion at /home/mine/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/mine/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::Ptr{Nothing}) at /home/mine/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
[6] #pycall#109 at /home/mine/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11 [inlined]
[7] pycall at /home/mine/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:83 [inlined]
[8] #show#148 at /home/mine/.julia/packages/PyPlot/4wzW1/src/PyPlot.jl:183 [inlined]
[9] show() at /home/mine/.julia/packages/PyPlot/4wzW1/src/PyPlot.jl:183
[10] top-level scope at /home/mine/Work/TDGL/src/plot.jl:5
in expression starting at /home/mine/Work/TDGL/src/plot.jl:5

```

My julia version is 1.2.0.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Reproduce the Julia 1.2.0 script in plot.jl and inspect PyPlot.jl:183, where show() calls matplotlib.pyplot.show. Trace the reported Python path through matplotlib/pyplot.py and backend_qt5.py, paying attention to the signal handler restoration. Done means closing the plot window no longer raises the shown PyError.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, matplotlib, python
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。