Confusing error when saving the wrong thing

オープン
#347 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
julia
領域
tooling

調査の方向性

issue の tuple のケースを再現し、その後 src/loadsave.jl にある FileIO のアクションパスと src/error_handling.jl のエラーハンドリングを調べてください。成功する figure の保存と比較し、報告された失敗が無効な引数と利用できない image loaders を区別し、誤解を招くインストール案内を行わないようにしてください。再現を再実行して、結果として生じるエラーを確認してください。

索引モデルが issue の本文から書いたものです。

説明

julia> using CairoMakie

julia> fig = lines(rand(10));

julia> save("test.png", fig) # works
CairoScreen{Cairo.CairoSurfaceBase{UInt32}} with surface:
Cairo.CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x00007fef60cecfa0, 800.0, 600.0)

julia> save("test.png", (fig, )) # wrong argument gives confusing errors
Errors encountered while save FileIO.File{FileIO.DataFormat{:PNG}, String}("test.png").
All errors:
===========================================
ImageIO writer error: neither save nor fileio_save is defined
  due to MethodError(ImageIO.save, (FileIO.File{FileIO.DataFormat{:PNG}, String}("test.png"), (Scene (800px, 600px):
  18 Plots:
    ├ Combined{Makie.poly, Tuple{Vector{Vector{Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    └ MakieCore.Text{Tuple{String}}
  1 Child Scene:
    └ Scene (724px, 541px),)), 0x0000000000007aad)
  Will try next loader.

===========================================
ArgumentError: Package QuartzImageIO [dca85d43-d64c-5e67-8c65-017450d5d020] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

===========================================
ArgumentError: Package ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

===========================================
ArgumentError: Argument does not support conversion to png.
===========================================

Fatal error:
ERROR: ImageIO writer error: neither save nor fileio_save is defined
  due to MethodError(ImageIO.save, (FileIO.File{FileIO.DataFormat{:PNG}, String}("test.png"), (Scene (800px, 600px):
  18 Plots:
    ├ Combined{Makie.poly, Tuple{Vector{Vector{Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ LineSegments{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{String}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ MakieCore.Text{Tuple{Vector{Tuple{AbstractString, Point{2, Float32}}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    ├ Lines{Tuple{Vector{Point{2, Float32}}}}
    └ MakieCore.Text{Tuple{String}}
  1 Child Scene:
    └ Scene (724px, 541px),)), 0x0000000000007aad)
  Will try next loader.

Stacktrace:
  [1] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
  [2] invokelatest
    @ ./essentials.jl:714 [inlined]
  [3] action(call::Symbol, libraries::Vector{Union{Base.PkgId, Module}}, file::FileIO.Formatted, args::Tuple{Makie.FigureAxisPlot}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:217
  [4] action
    @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:197 [inlined]
  [5] action(call::Symbol, libraries::Vector{Union{Base.PkgId, Module}}, sym::Symbol, file::String, args::Tuple{Makie.FigureAxisPlot}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:185
  [6] action
    @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:185 [inlined]
  [7] #save#20
    @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:129 [inlined]
  [8] save(file::String, args::Tuple{Makie.FigureAxisPlot})
    @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:126
  [9] top-level scope
    @ REPL[23]:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval_user_input(ast::Any, backend::REPL.REPLBackend)
    @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:150
 [12] repl_backend_loop(backend::REPL.REPLBackend)
    @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:241
 [13] start_repl_backend(backend::REPL.REPLBackend, consumer::Any)
    @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:226
 [14] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
    @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:359
 [15] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:346
 [16] (::Base.var"#919#921"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:394
 [17] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [18] invokelatest
    @ ./essentials.jl:714 [inlined]
 [19] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:379
 [20] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:309
 [21] _start()
    @ Base ./client.jl:495
Stacktrace:
 [1] handle_error(e::FileIO.WriterError, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
   @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/error_handling.jl:61
 [2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector}}, action::String)
   @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/error_handling.jl:56
 [3] action(call::Symbol, libraries::Vector{Union{Base.PkgId, Module}}, file::FileIO.Formatted, args::Tuple{Makie.FigureAxisPlot}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:226
 [4] action
   @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:197 [inlined]
 [5] action(call::Symbol, libraries::Vector{Union{Base.PkgId, Module}}, sym::Symbol, file::String, args::Tuple{Makie.FigureAxisPlot}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:185
 [6] action
   @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:185 [inlined]
 [7] #save#20
   @ ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:129 [inlined]
 [8] save(file::String, args::Tuple{Makie.FigureAxisPlot})
   @ FileIO ~/.julia/packages/FileIO/JA3Vl/src/loadsave.jl:126
 [9] top-level scope
   @ REPL[23]:1

As you can see, save("test.png", fig) works correctly (so in particular, no additional packages need to be installed to save a PNG). However, if you get the second argument wrong (here I pass a tuple containing the figure instead of the figure), the error seems to suggest installing other packages, etc.

I think the right information is there (there's some MethodErrors and Argument does not support conversion to png) but there's also a bunch of what feels to be misleading information, e.g.

ArgumentError: Package QuartzImageIO [dca85d43-d64c-5e67-8c65-017450d5d020] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

seems to be telling me to run Pkg.instantiate() to try to fix the problem, or maybe add QuartzImageIO.

主要言語
Julia
スター
228
フォーク
83
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaIO/FileIO.jl のほかの issue

JuliaIO/FileIO.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。