Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to gama are not working on Windows #1

Open
LucieContamin opened this issue Jul 2, 2019 · 3 comments
Open

Call to gama are not working on Windows #1

LucieContamin opened this issue Jul 2, 2019 · 3 comments
Assignees
Labels
bug Something isn't working priority Priority

Comments

@LucieContamin
Copy link
Member

After downloading, installing and using defpath to link GAMA and rama on Windows, I try to run the code:

gaml_file <- system.file("models", "sir.gaml", package = "rama")
exp1 <- load_experiment("sir", gaml_file)

and I obtain the error:

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : 
    cannot open file `C:\Users\TEMPFILE.stdout` : No such file or directory

It might be an error coming from the function system2 which returns an error 127.

@LucieContamin LucieContamin transferred this issue from r-and-gama/rama Jul 10, 2019
@LucieContamin LucieContamin added bug Something isn't working priority Priority labels Jul 23, 2019
@LucieContamin
Copy link
Member Author

It might be because the path in R are written like C:/Program Files/gama and should be something like: C:\Program Files\gama (needed to be tested)

@DAM-Philippon
Copy link

Hi, got the same problem, any update or workaround on this one ?

> gaml_file <- system.file("models", "sir.gaml", package = "rama")
> exp1 <- load_experiment("sir", gaml_file)
Loading experiment "sir" from file ""...
active display
> JAI/ImageIO subsystem activated
An error has occurred. See the log file
C:\Users\damie\Documents\workspace\.metadata\.log.
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:\Users\damie\AppData\Local\Temp\RtmpiCv1Xw\file171cc7b8c17b0.stdout': No such file or directory

@daanieo
Copy link

daanieo commented Dec 20, 2020

The bug could be related to LucieContamin's message:

It might be because the path in R are written like C:/Program Files/gama and should be something like: C:\Program Files\gama (needed to be tested)

But: on my machine (Linux Mint 20), I ran into the same problem as you. For me, the problem lies in the call_gama function, more specifically where the Headless Java command is formulated:
run$exitStatus <- system2( command = 'java', args = c('-jar', getOption("gamar.startjar"), '-Xms', getOption("gamar.Xms"), '-Xmx', getOption("gamar.Xmx"), '-Djava.awt.headless=true org.eclipse.core.launcher.Main', '-application msi.gama.headless.id4', '-hpc', hpc, '-v', parameter_xml_file, output_dir_gama, '>', shQuote(stdoutFile), '2>', shQuote(stderrFile)))

My suspicion is that in our case the function does not properly handle the output and subsequently the following line:

 run$stdout <-  readLines(stdoutFile)
  run$stderr <-  readLines(stderrFile)

causes the error we're after.

In my case, running an experiment using the call_gama function created an ouput XML in the same folder as the parameter_xml_file is located. I wrote some extra code around call_gama in order to import the experiment outcomes and so bypassing the parts of load_experiment that didn't work for me:

call_gama(tmp_xml,hpc=2,output_dir = tmp_dir) # run gama model
   
# import outcome xml 
tmp_df<-XML::xmlToDataFrame(XML::xmlParse(paste0(tmp_dir,"/","simulation-outputs",simulation_id,".xml")), stringsAsFactors = FALSE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority Priority
Projects
None yet
Development

No branches or pull requests

6 participants