0
votes

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?

1
Take a look to r"F:\Otim\Interface\ElGrs. gms", there is a whitespace after ElGrs. , that doesn't seem to be a valid pathBPL
With or without whitespace after ElGr it gives the same error, only changes "status 6" to "status 3"... If I open gamside it works but gams only doesn't work.. But I need to call gams and not gamsideSofia Raimundo

1 Answers

0
votes

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.