gama-platform / gama

Main repository for developing the 2024+ versions of GAMA
https://gama-platform.org
GNU General Public License v3.0
11 stars 4 forks source link

Saving a simulation in binary raises IOError #201

Closed lesquoyb closed 2 weeks ago

lesquoyb commented 1 month ago

Describe the bug When using the save statement with binary format I have an I/O error:

1 occurence in a0 at cycle 0: Java error: I/O error
in a0
in agent a0
in save simulation format: 'binary' to: 'sim.bin' ;
NoSuchFileException: D:\GamaTraining2024-OUCRU\TrainingModels\models\sim.bin
java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
java.base/java.nio.file.Files.newOutputStream(Files.java:228)
gama.extension.serialize.binary.BinarySerialisation.saveToFile(BinarySerialisation.java:202)
in save simulation format: 'binary' to: 'sim.bin' ;
in init  {
    save simulation format: 'binary' to: 'sim.bin' ;
    write i ;
}

So there are two problems:

  1. The other formats do not require the file to initially exists (and I don't see why any format would require that)
  2. The error arose even if the file already exists

To Reproduce Steps to reproduce the behavior:

  1. Run this model:
    
    model testrestore

global { init r { }

}

experiment a {

init {
    save simulation to: 'sim.bin' format:"binary";
    write i;        
}

}


5. See error

**Expected behavior**
I can create a file with the binary format like with any other format.
lesquoyb commented 2 weeks ago

Closing because it's not happening anymore, idk if it's thanks to some recent changes in the code or maybe it was a problem in my workspace/project