JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

no method matching getproperty(::PyPlot.LazyPyModule, ::String) #437

Closed RaulDurand closed 4 years ago

RaulDurand commented 5 years ago

After an update, I got the error below while trying to use PyPlot.Axes3D(figure()):

ERROR: MethodError: no method matching getproperty(::PyPlot.LazyPyModule, ::String)
Closest candidates are:
  getproperty(::PyCall.PyObject, ::AbstractString) at /home/raul/.julia/packages/PyCall/ttONZ/src/PyCall.jl:302
  getproperty(::Figure, ::AbstractString) at /home/raul/.julia/packages/PyPlot/cdCMF/src/PyPlot.jl:66
  getproperty(::ColorMap, ::AbstractString) at /home/raul/.julia/packages/PyPlot/cdCMF/src/colormaps.jl:26
  ...
Stacktrace:
 [1] #Axes3D#179(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Figure) at /home/raul/.julia/packages/PyPlot/cdCMF/src/plot3d.jl:54
 [2] Axes3D(::Figure) at /home/raul/.julia/packages/PyPlot/cdCMF/src/plot3d.jl:54

It seems that the getproperty definition for PyPlot.LazyPyModule is missing in PyPlot.jl.

After adding the definition below in the REPL PyPlot.Axes3D(figure()) works again.

Base.getproperty(lm::PyPlot.LazyPyModule, s::AbstractString) = getproperty(PyCall.PyObject(lm), s)
RaulDurand commented 4 years ago

On top of that, I still get the following warning:

┌ Warning: `getindex(o::PyObject, s::Symbol)` is deprecated in favor of dot overloading (`getproperty`) so elements should now be accessed as e.g. `o.s` instead of `o[:s]`.
│   caller = getindex(::PyPlot.LazyPyModule, ::Symbol) at plot3d.jl:13
└ @ PyPlot ~/.julia/packages/PyPlot/4wzW1/src/plot3d.jl:13
RaulDurand commented 4 years ago

Is there any plan to solve this?

stevengj commented 4 years ago

Sorry, it fell off the radar. Should be fixed by #473.