lundi 11 juillet 2016

How to execfile after the Python Shell (Gurobi Interactive Shell) starts using python script

(Gurobi is a program for linear programming - optimization running on Python)

I have a Python script below which should do de following:

  1. Open the Python Shell (Gurobi interactive Shell)
  2. Wait till it is open.
  3. Exectue execfile.

launcher.py

import subprocess
process = subprocess.Popen('gurobi.bat')
process.wait()
execfile('commands.py')

gurobi.bat runs the Python Interactive Shell

commands.py contains the commands i want to execute. If I write execfile('commands.py') in the shell it works. I want that it works automatically by running the launcher.py script. Now it is just running the Python Shell and nothing happens afterwards.

PS: I am a newbie in Python

Aucun commentaire:

Enregistrer un commentaire