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

ArgumentError: PlotlyJS.SyncPlot doesn't have a defined StructTypes.StructType #153

Closed
bionicinnovations opened this issue Dec 1, 2021 · 3 comments

Comments

@bionicinnovations
Copy link

bionicinnovations commented Dec 1, 2021

Hi there,

I recently upgraded Dash.jl from v1.1.0 -> v1.0.0 which adds JSON3 v 1.9.2 and StructTypes v1.8.1. After upgrading, my Dash.jl app no longer works. If I downgrade back to 1.0.0, it works again.

The error message I get under v1.1.1 is as follows (note that PlotlyJS seems to work fine outside the Dash app):

[ Info: Listening on: 0.0.0.0:9151
┌ Error: error handling request
│   exception =
│    ArgumentError: PlotlyJS.SyncPlot doesn't have a defined `StructTypes.StructType`
│    Stacktrace:
│      [1] write(::StructTypes.NoStructType, buf::Vector{UInt8}, pos::Int64, len::Int64, ::PlotlyJS.SyncPlot; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:91
│      [2] write(::StructTypes.NoStructType, buf::Vector{UInt8}, pos::Int64, len::Int64, ::PlotlyJS.SyncPlot)
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:91
│      [3] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:155
│      [4] write
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:146 [inlined]
│      [5] #_#72
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:121 [inlined]
│      [6] WriteClosure
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:112 [inlined]
│      [7] foreachfield
│        @ C:\Users\zxxx\.julia\packages\StructTypes\Cmlkm\src\StructTypes.jl:640 [inlined]
│      [8] #write#73
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:132 [inlined]
│      [9] write
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:130 [inlined]
│     [10] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::NTuple{48, Component}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:169
│     [11] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::NTuple{48, Component})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:165
│     [12] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:155
│     [13] write
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:146 [inlined]
│     [14] #_#72
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:121 [inlined]
│     [15] WriteClosure
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:112 [inlined]
│     [16] foreachfield
│        @ C:\Users\zxxx\.julia\packages\StructTypes\Cmlkm\src\StructTypes.jl:640 [inlined]
│     [17] #write#73
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:132 [inlined]
│     [18] write
│        @ C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:130 [inlined]
│     [19] write(obj::Component; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:39
│     [20] write(obj::Component)
│        @ JSON3 C:\Users\zxxx\.julia\packages\JSON3\tqMvg\src\write.jl:37
│     [21] process_layout(request::HTTP.Messages.Request, state::Dash.HandlerState)
│        @ Dash C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\handler\processors\layout.jl:4
│     [22] try_handle
│        @ C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\router.jl:51 [inlined]
│     [23] try_handle(route::Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_layout)}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState)
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\router.jl:97       
│     [24] _handle
│        @ C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\router.jl:101 [inlined]
│     [25] handle(route_tuple::Tuple{Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_layout)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_dependencies)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_reload_hash)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_default_favicon)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:path, :namespace), Tuple{Int64, Int64}}}, typeof(Dash.process_resource)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:file_path,), Tuple{Int64}}}, typeof(Dash.process_assets)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_callback)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Dash.process_index)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_index)}}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState)
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\router.jl:112      
│     [26] handle(router::Dash.HttpHelpers.Router, request::HTTP.Messages.Request, args::Dash.HandlerState) 
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\router.jl:129      
│     [27] (::Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState})(::HTTP.Messages.Request)
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\handlers.jl:4      
│     [28] handle
│        @ C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Handlers.jl:254 [inlined]
│     [29] (::Dash.HttpHelpers.var"#7#8"{Dash.var"#67#69"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}})(::HTTP.Messages.Request)        
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\handlers.jl:48     
│     [30] handle
│        @ C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Handlers.jl:254 [inlined]
│     [31] (::Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#67#69"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}})(::HTTP.Messages.Request)
│        @ Dash.HttpHelpers C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\HttpHelpers\handlers.jl:27     
│     [32] handle
│        @ C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Handlers.jl:254 [inlined]
│     [33] handle(::HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#67#69"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}}}, ::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│        @ HTTP.Handlers C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Handlers.jl:277
│     [34] #4
│        @ C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Handlers.jl:351 [inlined]
│     [35] macro expansion
│        @ C:\Users\zxxx\.julia\packages\HTTP\aTjcj\src\Servers.jl:415 [inlined]
│     [36] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#67#69"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}}}}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Servers.Server{Nothing, Sockets.TCPServer}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})()
│        @ HTTP.Servers .\task.jl:411
└ @ Dash C:\Users\zxxx\.julia\packages\Dash\soFjZ\src\handler\make_handler.jl:112

This same error occurred on julia v1.6.4:

julia> versioninfo()
Julia Version 1.6.4
Commit 35f0c911f4 (2021-11-19 03:54 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: AMD Ryzen Threadripper 1920X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver1)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

And also on Dash v1.1.0 on Julia v1.7.0:

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: AMD Ryzen Threadripper 1920X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, znver1)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =

Thanks for all your hard work on this project!

@waralex
Copy link
Collaborator

waralex commented Dec 9, 2021

Hi!
Sorry I didn't answer right away
Usually this error occurs when you use 'plot()' instead of 'Plot()'. Apparently there is no overload in PlotlyJS to SyncPlot for JSON3.
I have always believed that PlotlyBase.Plot() should be used because this is exactly the construction of the graph, and the `plot()' function serves not only for construction, but also for display. Therefore, I did not consider this issue as an error. However, since this is not the first time such confusion arises, I will think about how to deal with it either within Dash or within PlotlyBase

@HackYardo
Copy link

Thank you a lot! 😆

@etpinard
Copy link
Collaborator

PlotlyJS.SyncPlot now have their own to_dash method from plotly/DashBase.jl#4 and plotly/DashBase.jl#9 - set to be release as part of Dash.jl v1.4.0

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

4 participants