Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. import subprocess
  2.  
  3. frams_cli_path = r'C:\Users\kapis\Desktop\PUT\magisterka\semestr2\Komosiński\LAB\Framstics\Framsticks50rc13\frams.exe'
  4. command = f'"{frams_cli_path}" "expdef standardMY" "im case_study_experiment_state7.expt" "Math.randomize();" "Simulator.init();" "Simulator.start();" "while (ExpState.totaltestedcr<100) Simulator.step();" "sa koniec_%%N.expt" "-q"'
  5.  
  6.  
  7. def invoke_calculations():
  8.     p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
  9.     output, err = p.communicate()
  10.     p.wait()
  11.     return output
  12.  
  13.  
  14. def prepare_significant_lines(output):
  15.     lines = output.decode().splitlines()
  16.     significant_lines = [line for line in lines if "[LOG]" in line]
  17.     return significant_lines
  18.  
  19.  
  20. def main():
  21.     output = invoke_calculations()
  22.     significant_lines = prepare_significant_lines(output)
  23.  
  24.  
  25. if __name__ == '__main__':
  26.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement