简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM