Git Product home page Git Product logo

Comments (4)

timholy avatar timholy commented on May 28, 2024

Not for me. Can you provide a fully-reproducible example? Something that runs if you just copy/paste it in the REPL. I can handle the directory-creation, don't worry about that part.

from fileio.jl.

guo-yong-zhi avatar guo-yong-zhi commented on May 28, 2024

Sorry for the confusion. I thought the bug was common. But it may only be triggered by a specific type, I guess.
Here is a a fully-reproducible example:

using FileIO
using Luxor

function randpic(size=32)
    d = Drawing(size, size, :image)
    origin()
    background(1,1,1)
    setcolor(1,0,0)
    circle(Point(0, 0), size÷2; action=:fill)
    mat = image_as_matrix()
    finish()
    mat
end
pic = randpic();
@show typeof(pic)

mkdir("datasets2")
for i in 1:20000
    save("datasets2/$i.png", pic)
end

typeof(pic) = Base.ReinterpretArray{ARGB32, 2, UInt32, Matrix{UInt32}, false}
All errors:
===========================================
MethodError: no method matching _get_color_type(::Matrix{ARGB32})
Closest candidates are:
_get_color_type(::IndirectArrays.IndirectArray) at ~/.julia/packages/PNGFiles/oYmtV/src/io.jl:526
_get_color_type(::AbstractArray{<:Gray{T}}) where T at ~/.julia/packages/PNGFiles/oYmtV/src/io.jl:518
_get_color_type(::AbstractArray{<:GrayA{T}}) where T at ~/.julia/packages/PNGFiles/oYmtV/src/io.jl:519
...
===========================================
WriteBlob Failed `datasets2/4040.png' @ error/png.c/MagickPNGErrorHandler/1642
===========================================
SystemError: opening file "datasets2/4040.png": Too many open files
===========================================
Errors encountered while save File{DataFormat{:PNG}, String}("datasets2/4040.png").


My environment:

Julia Version 1.7.0-rc2
Commit f23fc0d27a (2021-10-20 12:45 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

Status ~/.julia/environments/v1.7/Project.toml
[5789e2e9] FileIO v1.11.2
[916415d5] Images v0.24.1
[ae8d54c2] Luxor v2.16.0

from fileio.jl.

guo-yong-zhi avatar guo-yong-zhi commented on May 28, 2024

Is there anything can be done in FileIO.jl? After all the manual open-save-close form works fine. I don't know FileIO's mechanism, but as a user I hope the framework will force close everything it opened. Thank you.

from fileio.jl.

timholy avatar timholy commented on May 28, 2024

https://github.com/JuliaIO/ImageMagick.jl/blob/079d62b859d5af2ef1c05b4b3e0948cd0ec1d9bd/src/libmagickwand.jl#L292-L296

So FileIO doesn't handle the opening/closing.

from fileio.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.