Python API: Option Export
Posted: Thu May 14, 2020 8:08 am
Hi
I am trying to export options to a file with GAMS API under PYthon 3.8 using the follwing code:
This raises an error in options.py:
options.defines seems to be implemented as dictionary, and I wonder whether the "for" statement misses a ".items()" statement. Or do I miss something here?
Best regards
Jan
I am trying to export options to a file with GAMS API under PYthon 3.8 using the follwing code:
Code: Select all
import gams
import os
ws = gams.GamsWorkspace(os.getcwd())
opt = ws.add_options()
opt.defines["test"] = 5
opt.export("./test.gms")
~\anaconda3\envs\py38_gams\lib\site-packages\gams\options.py in export(self, file_path)
2212 file.write(cfgModelTypeName(self._cfg, i) + "=" + self._selected_solvers + "\n")
2213 if len(self.defines) > 0:
-> 2214 for k,v in self.defines:
2215 file.write("--" + k + "=" + v + "\n")
2216 file.close()
ValueError: too many values to unpack (expected 2)
options.defines seems to be implemented as dictionary, and I wonder whether the "for" statement misses a ".items()" statement. Or do I miss something here?
Best regards
Jan