Description of the issue
I would like it if
Range Statistics SOLVE simple Using LP From line 147
also output where line 47 lives, as in
Range Statistics SOLVE simple Using LP From line 147 of coolfile.py
This would be handy when scripting.
Error message and stack trace
N/A
GAMSPy version
1.1.0
GAMSPy is running GAMS in the background, and the line you mention is from the GAMS file that GAMSPy executes. We can technically pass the line number and the file name from the Python script so that it appears in the listing file. We will consider this. Thanks for the suggestion!
As an alternative, you can just get the filename and the line number of the solve as follows in Python:
import gamspy as gp
import inspect
m = Container()
...
...
Define your model here
...
...
frame = inspect.currentframe()
filename = frame.f_code.co_filename
line_number = frame.f_lineno + 1
model.solve()
print(f"{filename=}, {line_number=}")