This doesn’t quite answer your question, however, I do the following very often.
I put “m.pprint()” in my Python script and then from the terminal:
Then the output is stored in output.txt. This is not a Pyomo command, but a bash shell capability. There may be other ways to capture the pprint output in Python.
Regards,
Carl.
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pyomo-forum...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyomo-forum/a7fc6493-1993-48f8-87b8-a71e9ff173aan%40googlegroups.com.
pprint() takes an ostream argument:
with open('output.txt', 'w') as FILE:
model.pprint(ostream=FILE)
John
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/84E2F9FF-3E52-49BF-AC8E-BC915723ACAF%40sandia.gov.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/5c2ea6d4682d4387a9a4a4b455279167%40ES02AMSNLNT.srn.sandia.gov.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/84E2F9FF-3E52-49BF-AC8E-BC915723ACAF%40sandia.gov.