Run a gams file in background with python

62 views
Skip to first unread message

Sofia Raimundo

unread,
Apr 28, 2016, 9:56:22 AM4/28/16
to gamsworld
Hi!
I'm working with ArcGis program who read python scripts.
I need to run in background a gams file, .gms but I don't know how can I do this.
I searched at the internet and I saw this in this forum:
 
startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        output = subprocess.Popen("gams " + gamspath + "\\" + filename + ".gms Lo=2 Lf="+ gamspath + "\\" + filename +"solved.txt" , stdout=subprocess.PIPE, startupinfo=startupinfo)

solvedFile = open(gamspath + "\\" + filename +"solved.txt" )
     
but when I run this code, changing only the filename, gives me an error like this: "NameError: name 'gamspath' is not defined" and I don't know how can I solve this...
Someone can help me please? Thank's!!
Reply all
Reply to author
Forward
0 new messages