JuliaIO / ImageIO.jl

Load images in Julia. Designed for FileIO interaction. Supports PNG and Portable Bitmap formats
MIT License
28 stars 11 forks source link

TiffImages convert methods are too new. Needs invokelatest #34

Closed IanButterworth closed 3 years ago

IanButterworth commented 3 years ago

I thought this was fixed v0.5.4

cc. @johnnychen94

(@v1.6) pkg> activate --temp
  Activating new environment at `/var/folders/_6/1yf6sj0950vcg4t91m9ltb5w0000gn/T/jl_EHc16X/Project.toml`

(jl_EHc16X) pkg> add ImageIO, FileIO
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `/private/var/folders/_6/1yf6sj0950vcg4t91m9ltb5w0000gn/T/jl_EHc16X/Project.toml`
  [5789e2e9] + FileIO v1.9.0
  [82e4d734] + ImageIO v0.5.4
    Updating `/private/var/folders/_6/1yf6sj0950vcg4t91m9ltb5w0000gn/T/jl_EHc16X/Manifest.toml`
  [621f4979] + AbstractFFTs v1.0.1
...

julia> using FileIO

julia> load("img.tiff");

Errors encountered while load File{DataFormat{:TIFF}, String}("img.tiff").
All errors:
===========================================
ImageIO load error: neither load nor fileio_load is defined
  due to MethodError(size, (ERROR: MethodError: no method matching size(::TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
The applicable method may be too new: running in world age 29613, while current world is 29623.
Closest candidates are:
  size(::TiffImages.DenseTaggedImage) at /Users/ian/.julia/packages/TiffImages/ZnhmN/src/types/dense.jl:24 (method too new to be called from this world context.)
  size(::AbstractArray{T, N}, ::Any) where {T, N} at abstractarray.jl:38
  size(::Union{LinearAlgebra.Adjoint{T, var"#s832"}, LinearAlgebra.Transpose{T, var"#s832"}} where {T, var"#s832"<:(AbstractVector{T} where T)}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:196
  ...
Stacktrace:
  [1] length
    @ ./abstractarray.jl:250 [inlined]
  [2] isempty(a::TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
    @ Base ./abstractarray.jl:1099
  [3] typeinfo_prefix(io::IOContext{Base.TTY}, X::TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
    @ Base ./arrayshow.jl:543
  [4] show(io::IOContext{Base.TTY}, X::TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}})
    @ Base ./arrayshow.jl:447
  [5] show_delim_array(io::IOContext{Base.TTY}, itr::Tuple{TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}}}, op::Char, delim::Char, cl::Char, delim_one::Bool, i1::Int64, n::Int64)
    @ Base ./show.jl:1124
  [6] show_delim_array
    @ ./show.jl:1109 [inlined]
  [7] show(io::IOContext{Base.TTY}, t::Tuple{TiffImages.DenseTaggedImage{ColorTypes.RGB{FixedPointNumbers.N0f8}, 2, UInt32, Matrix{ColorTypes.RGB{FixedPointNumbers.N0f8}}}})
    @ Base ./show.jl:1142
  [8] _show_default(io::Base.TTY, x::Any)
    @ Base ./show.jl:412
  [9] show_default
    @ ./show.jl:395 [inlined]
 [10] show
    @ ./show.jl:390 [inlined]
 [11] print(io::Base.TTY, x::MethodError)
    @ Base ./strings/io.jl:35
 [12] print(::Base.TTY, ::String, ::String, ::Vararg{Any, N} where N)
    @ Base ./strings/io.jl:46
 [13] println
    @ ./strings/io.jl:73 [inlined]
 [14] showerror(io::Base.TTY, e::FileIO.LoaderError)
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/error_handling.jl:11
 [15] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector{T} where T}}, action::String)
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/error_handling.jl:47
 [16] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Formatted; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:225
 [17] action
    @ ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:196 [inlined]
 [18] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:185
 [19] action
    @ ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:185 [inlined]
 [20] load(::String; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:113
 [21] load(::String)
    @ FileIO ~/.julia/packages/FileIO/3jBq2/src/loadsave.jl:110
 [22] top-level scope
    @ REPL[4]:2
IanButterworth commented 3 years ago

Fix explained in https://github.com/JuliaIO/ImageIO.jl/pull/35

As an aside, this FileIO error was very difficult to read & figure out:

  1. FileIO overgeneralizes on a MethodError catch and incorrectly reports
    ImageIO load error: neither load nor fileio_load is defined
    due to MethodError(size, 
  2. The error cache then reprint was failing during print due to the world age problem, causing the error shows to clash
    due to MethodError(size, (ERROR: MethodError: no method matching size(::Tiff...
                          ^ this is a new error message actually throwing during the error print