def callGams(gamsxHandle, optHandle, sysDir, model): deffile = sysDir + "/optgams.def" if optReadDefinition(optHandle, deffile): print("*** Error ReadDefinition, cannot read def file:" + deffile) return False optSetStrStr(optHandle, "SysDir", sysDir) optSetStrStr(optHandle, "WorkDir", sim_folder) optSetStrStr(optHandle, "Input", model) optSetIntStr(optHandle, "LogOption", logoption) ret = gamsxRunExecDLL(gamsxHandle, optHandleToPtr(optHandle), sysDir, 1) if ret[0] != 0: print("*** Error RunExecDLL: Error in GAMS call = " + str(ret[1])) return False return True
def callGams(gamsxHandle, optHandle, sysDir, model): deffile = force_str(os.path.join(sysDir, 'optgams.def')) if optReadDefinition(optHandle, deffile): logging.error("*** Error ReadDefinition, cannot read def file:" + deffile) return False optSetStrStr(optHandle, "SysDir", sysDir) optSetStrStr(optHandle, "WorkDir", sim_folder) optSetStrStr(optHandle, "Input", model) optSetIntStr(optHandle, "LogOption", logoption) ret = gamsxRunExecDLL(gamsxHandle, optHandleToPtr(optHandle), sysDir, 1) if ret[0] != 0: logging.error("*** Error RunExecDLL: Error in GAMS call = " + str(ret[1])) if 'White space' in str(ret[1]): logging.error("The Unix GAMS API does not accept white spaces. Move dispaset to a folder that does not contain white spaces") return False return True