Sofia Raimundo
Sofia Raimundo

Reputation: 101

Execute Gams in background on Python 2.7

I need to call and run gams at background from a Python script.

I'm using:

import subprocess
subprocess.check_call([r"C:\GAMS\win64\24.4\gams.exe",r"F:\Otim\Interface\ElGr.gms"])

And it gives me this error:

Traceback (most recent call last): File "F:/Otim/Interface/tent_backgroundgams.py", line 91, in subprocess.check_call([r"C:\GAMS\win64\24.4\gams.exe",r"F:\Otim\Interface\ElGrs. gms"]) File "C:\Python27\ArcGIS10.2\lib\subprocess.py", line 511, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '['C:\GAMS\win64\24.4\gams.exe', 'F:\Otim\Interface\ElGr. gms']' returned non-zero exit status 6

How can I solve it?

Upvotes: 0

Views: 485

Answers (1)

Lutz
Lutz

Reputation: 2292

Here is a list of the meanings of the different exit codes: https://www.gams.com/help/index.jsp?topic=%2Fgams.doc%2Fuserguides%2Fuserguide%2F_u_g__g_a_m_s_return_codes.html

So, 6 means "there was a parameter error" (because the file specified could not be found with the extra whitespace). 3 means "there was an execution error". So, there was some error while GAMS runs you model. By default you should find an lst file (ElGrs.lst) in your working copy. If you search for "****" in that file, you should see what went wrong and where the error appears.

Upvotes: 0

Related Questions