JuliaPy / PythonPlot.jl

Plotting for Julia based on matplotlib.pyplot
MIT License
74 stars 8 forks source link

`close(::Figure)` still broken #22

Closed IanButterworth closed 1 year ago

IanButterworth commented 1 year ago

@stevengj The fix for #21 didn't work I'm afraid.

On main https://github.com/stevengj/PythonPlot.jl/commit/cc633dd2536513736bfaea4c47a1da86e25549fb

julia> f = PythonPlot.figure(figsize = (6, 6), dpi = 100)
Figure(<py Figure size 600x600 with 0 Axes>)

julia> close(f)
ERROR: cannot convert this Python 'NoneType' to a Julia 'Int64'
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] macro expansion
   @ ~/.julia/packages/PythonCall/dsECZ/src/convert.jl:355 [inlined]
 [3] macro expansion
   @ ~/.julia/packages/PythonCall/dsECZ/src/Py.jl:131 [inlined]
 [4] pyconvert(#unused#::Type{Int64}, x::PythonCall.Py)
   @ PythonCall ~/.julia/packages/PythonCall/dsECZ/src/convert.jl:370
 [5] plotclose(f::Figure)
   @ PythonPlot ~/.julia/packages/PythonPlot/oPo8Q/src/PythonPlot.jl:193
 [6] close(f::Figure)
   @ PythonPlot ~/.julia/packages/PythonPlot/oPo8Q/src/PythonPlot.jl:189
 [7] top-level scope
   @ REPL[4]:1

It would've been good for the fix to be made in a PR with a test added.