mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
python3 execution of standalone monte_input #314
In the monte carlo input files I added a test for python 2/3. If we are 3 run exec(open("file").read()), else run execfile("file")
This commit is contained in:
parent
2eadf217a9
commit
5c117bcfe3
@ -118,7 +118,10 @@ int Trick::MonteCarlo::slave_process_run() {
|
||||
fprintf(fp,
|
||||
"# This run can be executed in stand alone (non-Monte Carlo) mode by running\n"
|
||||
"# the S_main executable with this file specified as the input file.\n\n");
|
||||
fprintf(fp, "execfile(\"%s\")\n\n", command_line_args_get_input_file());
|
||||
fprintf(fp, "if (sys.version_info > (3, 0)):\n");
|
||||
fprintf(fp, " exec(open(\"%s\").read())\n", command_line_args_get_input_file());
|
||||
fprintf(fp, "else:\n");
|
||||
fprintf(fp, " execfile(\"%s\")\n\n", command_line_args_get_input_file());
|
||||
fprintf(fp, "trick.mc_set_enabled(0)\n");
|
||||
fprintf(fp, "%s" , input);
|
||||
fclose(fp);
|
||||
|
Loading…
Reference in New Issue
Block a user