2017-07-28 131 views

回答

2

job.run()将引发存储在属性.rc返回代码的异常。因此:

try: 
    job.run() 
except GamsExceptionExecution as e: 
    print(e.rc) # This is a non-zero return code 
1

返回的代码应在同一文件夹中运行文件。

例如,与transport1.py例如这里https://gams.com/latest/docs/apis/examples_python/index.html详细,你可以找到.lst文件如下:

  • t1._file_name给你一个 “PATH \ transport.gms”(其中transport.gms是定义模型运行)
  • t1._job_name为您提供作业名
  • 从那里文件:PATH \ t1._job_name.lst是LST文件,如下所示:

    0123如果返回码是非零