Save-only error on newly registered file type with custom package
还没有人认领这个 Issue。
评估
调研方向
使用提供的 TestFileIO 环境以及模块的 load、save、detect_unv 和 add_loader 入口点复现该失败。在注册 UFFFiles 前后比较解析结果,然后确定为什么 save 需要 UFFFiles,而 load 可以成功。行为保持一致,并且提供的 MWE 成功运行或报告清晰且有意设计的错误,即表示完成。
由索引模型根据 Issue 内容生成。
描述
@maucejo 's https://github.com/maucejo/UFFFiles.jl was recently merged into the FileIO registry.
For my work, I have a custom package that handles similar files.
To handle the load / save logic, so far, I used the following in my package.
function load(f::File{format"UNV"})
...
end
function save(f::File{format"UNV"}, data)
...
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
function __init__()
add_format(format"UNV", detect_unv, [".unv", ".uff"], [MyPackage])
end
Since 1.18, which is the introduction of UFFFiles in the registry, my tests fail for save, but load works fine.
ERROR: ArgumentError: Package UFFFiles [20c5726e-8372-4c34-be2c-190a5a70d483] is required but does not seem to be installed
I could have expected that both success (as in previous FileIO versions) or fail, but I don't understand a partial fail.
Any ideas what could be the reason ?
I've attempted to make a MWE, but in a module, not totally a package, so the init-equivalent step may not be relevant as such.
using Pkg
Pkg.activate("TestFileIO")
Pkg.add(name="FileIO", version="1.17")
unvname = joinpath(tempdir(), "test.unv")
write(unvname, "test")
module TempFileIO
using FileIO
function load(f::File{FileIO.format"UNV"})
open(f, "r") do s
String(take!(s.io))
end
end
function save(f::File{FileIO.format"UNV"}, data)
open(f, "w") do s
write(s.io, data)
end
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
add_loader(format"UNV", detect_unv, [".unv", ".uff"], [TempFileIO])
end
using .TempFileIO
using FileIO
load(unvname) # Works regardless of version
save(unvname, "test") # Fails in 1.18+ since UFF is registered
- 主要语言
- Julia
- 星标
- 228
- 派生
- 83
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
JuliaIO/FileIO.jl 的其他 Issue
-
Drop the hard `Pkg` dependency可能已有人在做 @thchr 于 26 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
-
Add SVGZ format未关闭
难度 3/5 1-2 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 30/100
查看 JuliaIO/FileIO.jl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
-
question
难度 2/5 1-3 小时 新手友好度 68/100
brown-ccv/Chamber.jl#272 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
JuliaAstro/SolarPosition.jl#143 ·
-
distributions
难度 2/5 1-3 小时 新手友好度 72/100
JuliaBayes/Wren.jl#404 · 2 条评论 ·
维护者通常 1 天内回复
-
TargetEncoder: m = :auto uses the inverse of the empirical Bayes ratio and gives NaN for single-row levels可能已有人在做 @EssamWisam 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
JuliaAI/MLJTransforms.jl#113 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复