Repository navigation
Closed
Description
It looks like some mtg convention is not in agreement with what is accepted in openalea.
If I try to parser an mtg file used as example in openalea.mtg, I have an issue:
# curl https://raw.githubusercontent.com/openalea/mtg/refs/heads/master/src/openalea/mtg/data/agraf.mtg > agraf.mtg
using MultiScaleTreeGraph
read_mtg("agraf.mtg")
JuliaError: Error at line [51]: ColumnarAttrs is already bound to node id 3; pass `copy(attrs)` to a Node constructor t
o copy its current values.
Stacktrace:
[1] error(::String, ::String)
@ Base ./error.jl:44
[2] parse_mtg!(f::IOStream, classes::MultiScaleTreeGraph.ColumnTable, features::MultiScaleTreeGraph.ColumnTable, line
::Vector{Int64}, l::Vector{String}, mtg_type::Type)
@ MultiScaleTreeGraph ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/parse_mtg.jl:85
[3] parse_mtg_file(f::IOStream, mtg_type::Type)
@ MultiScaleTreeGraph ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/read_MTG.jl:129
[4] #18
@ ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/read_MTG.jl:66 [inlined]
[5] open(::MultiScaleTreeGraph.var"#18#19"{DataType}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
@ Base ./io.jl:410
[6] open(::Function, ::String, ::String)
@ Base ./io.jl:407
[7] read_mtg(file::String, mtg_type::Type; sheet_name::Nothing)
@ MultiScaleTreeGraph ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/read_MTG.jl:64
[8] read_mtg
@ ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/read_MTG.jl:44 [inlined]
[9] read_mtg(file::String)
@ MultiScaleTreeGraph ~/.julia/packages/MultiScaleTreeGraph/kbBTp/src/read_MTG/read_MTG.jl:44
[10] pyjlany_call(self::typeof(MultiScaleTreeGraph.read_mtg), args_::Py, kwargs_::Py)
@ PythonCall.JlWrap ~/.julia/packages/PythonCall/x9Db0/src/JlWrap/any.jl:48
[11] _pyjl_callmethod(f::Any, self_::Ptr{PythonCall.C.PyObject}, args_::Ptr{PythonCall.C.PyObject}, nargs::Int64)
@ PythonCall.JlWrap ~/.julia/packages/PythonCall/x9Db0/src/JlWrap/base.jl:71
[12] _pyjl_callmethod(o::Ptr{PythonCall.C.PyObject}, args::Ptr{PythonCall.C.PyObject})
@ PythonCall.JlWrap.Cjl ~/.julia/packages/PythonCall/x9Db0/src/JlWrap/C.jl:84
It fails at line 51 : ^/E1<<E35 .
In your parser, it is read treated as <.< and thus tries to copy ColumnarAttrs to multiple nodes, but in this case fails.
I can't judge the severity of this bug (not sure this mtg editing feature is very common) but it would be good to have mtg examples from both packages to be parsed without errors.
Add @pradal to the discussion
Metadata
Metadata
Assignees
Labels
No labels
Activity
VEZY commentedon Nov 20, 2026
Yep, I never saw this feature used in the field. But anyway, we should make it work if it's the standard. I guess I forget about that during the migration from node attributes to
ColumnarAttrs. I'll add all files from the tests in mtg into this repo, and run the reader on them. Thanks for the issue.pradal commentedon Nov 20, 2026
This is used to describe the topology when you have large trees.
I think I have a quite old (20yrs) presentation that describe all these shortcuts.