Comments (11)
Does it work if you manually assign the value "m1.jld"
to outfile
? Could you copy and paste the value of outfile
here? The question mark at the end of "m1.jld?"
could be the sign that an invalid character appears at the end of the string you read from the text file. In that case, it wouldn't be related at all to jldopen
.
from jld.jl.
Yes, it works now. I did a Pkg.update() and it works fine now. Closing the issue.
from jld.jl.
Okay, I am running into the same issue again. It works when I do it manually. I use the following piece of code
outfile = chomp(thisline[2]) # thisline[2] contains "m1.jld\n"
file = "m1.jld"
@assert outfile == file
fid = jldopen(outfile, "w");
write(fid, "TotalTime", totalWorkTime);
close(fid);
The file created in the folder is "m1.jld\n". If you notice I did do a chomp and have an assert statement.
from jld.jl.
Do you get the same result if you do outfile = chomp("m1.jld\n")
? And if you do open(outfile, "w")
instead of jldopen
?
from jld.jl.
I don't get any errors if I do that, but when I try to load up the data using julia it says ERROR: FileIO.File{FileIO.DataFormat{:UNKNOWN}}("m1.jld") couldn't be recognized by FileIO.
from jld.jl.
When you say "if I do that", do you mean when you do either of the changes separately? Please be very specific. (The fact that calling load
doesn't work is because the file doesn't contain correct data when you don't call jldopen
.)
Could you add @assert isfile(outfile)
before calling jldopen
? Could you also show the full backtrace of the error you showed in the description (i.e. with line numbers)?
from jld.jl.
I have a text file whose contents are as follows:
numMachines 1
timeSteps 720
categoryOneCount 1
categoryTwoPeriod 20
seed 2002
outfile m1.jld
END
I read out line by line and create a variable in my program: outfile = chomp(line[6][2])
Then, I run my algorithm and want to write its output to the outfile
using the following code:
file = "m1.jld"
@assert outfile == file
fid = jldopen(outfile, "w");
write(fid, "TotalTime", totalWorkTime);
close(fid);
The program throws an error for the above code. It also creates a file named "m1.jld\n" in the same folder. The error is as follows:
ERROR: LoadError: SystemError: opening file m1.jld: No such file or directory
in open at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in open at iostream.jl:102
in close at /Users/kaarthik/.julia/v0.4/JLD/src/JLD.jl:136
in include at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in process_options at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in _start at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
while loading /Users/kaarthik/Dropbox/Sandia/Code/main1.jl, in expression starting on line 347
HDF5-DIAG: Error detected in HDF5 (1.8.15-patch1) thread 0:
#000: H5F.c line 301 in H5Fget_obj_count(): not a file id
major: Invalid arguments to routine
minor: Bad value
jl_uv_writecb() ERROR: bad file descriptor EBADF
jl_uv_writecb() ERROR: bad file descriptor EBADF
jl_uv_writecb() ERROR: bad file descriptor EBADF
jl_uv_writecb() ERROR: bad file descriptor EBADF
jl_uv_writecb() ERROR: bad file descriptor EBADF
To fix this I changed the text file to
numMachines 1
timeSteps 720
categoryOneCount 1
categoryTwoPeriod 20
seed 2002
outfile m1.jld
All I do is remove the END line and the line break at the end of the last line. Then the code works fine and the output of the algorithm is written to the m1.jld file. I am able to retrieve the file contents.
from jld.jl.
Thanks, details are useful.
Still, does @assert isfile(outfile)
fail?
from jld.jl.
Sorry i missed that. Yes, @assert isfile(outfile)
fails
ERROR: LoadError: AssertionError: isfile(outfile)
in include at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in process_options at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
in _start at /Applications/Julia-0.4.2.app/Contents/Resources/julia/lib/julia/sys.dylib
while loading /Users/kaarthik/Dropbox/Sandia/Code/main1.jl, in expression starting on line 343
from jld.jl.
OK, so doesn't look like it's an issue with JLD.jl, but with Julia. To be clear, this code fails only at the last assertion, right?
outfile = chomp(thisline[2]) # thisline[2] contains "m1.jld\n"
file = "m1.jld"
@assert outfile == file
@assert isfile(file)
@assert isfile(outfile)
If so, does this one also fail?
outfile = thisline[2][1:end-1]
file = "m1.jld"
@assert outfile == file
@assert isfile(file)
@assert isfile(outfile)
from jld.jl.
Closing since this seems like it is not a JLD bug
from jld.jl.
Related Issues (20)
- Loading complex types seems to be broken with the latest HDF5_jll release HOT 12
- Sparse matrix loading error: "SparseArrays.SparseMatrixCSC{Core.Int8,Core.Int64} does not match currently loaded type" HOT 6
- TypeError: No NumPy equivalent for TypeBitfieldID exists
- TagBot trigger issue HOT 14
- Save and read a sharedarray in a jld file HOT 2
- anonymous function can't be saved, in Julia v1.6 HOT 1
- Parametric type load errors with StaticArrays: ERROR: stored type does not match currently loaded type
- Warning: JLD incorrectly extends FileIO functions HOT 3
- cannot append nested parametric types
- unable to load JLD - Core.AbstractArray{#s831,1},#s831 HOT 2
- error on Julia 1.7.0-beta2 HOT 9
- error with loading the jld file containg the reture value of Optim.optimize HOT 1
- JLD and JLD2 don't work in julia 1.7.0 HOT 2
- JLD error when using jldopen on a nested mutable struct before and after loading DSP.jl
- `LoadError: type DataType has no field mutable`
- better error message requested if filename isn't .jld
- How to view .jld files in VScode? HOT 2
- Broken on Julia v1.10 nightly HOT 1
- Storing/loading StepRangeLen fails HOT 2
- WARNING: could not import HDF5.exists into JLD HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jld.jl.