pulp icon indicating copy to clipboard operation
pulp copied to clipboard

Allow capturing logs as string

Open jerr0328 opened this issue 3 years ago • 2 comments

Describe the new feature

Similar to #188, I want to be able to capture the PuLP output and put it all in a single log line, rather than having it go to stdout directly. Instead of creating a temporary file and pointing PuLP to the log file, I would like to be able to get the log output as a string, similar to how you can do it with subprocess.check_output(). Alternatively, we could provide a file object (like StringIO) if that's easier.

Additional info

Please answer these questions before submitting your feature request.

Is your feature request related to an issue? Please include the issue number.

#188

Does this feature exist in another product or project? Please provide a link.

Python has a native way of getting output from subprocess command calls: https://docs.python.org/3/library/subprocess.html#subprocess.check_output

jerr0328 avatar Nov 23 '21 16:11 jerr0328

This make sense, many commercial solvers already provide a file object interface, if I remember correctly. I'd love to check a PR if you feel like helping out : )

pchtsp avatar Nov 28 '21 08:11 pchtsp

Is this feature implemented in https://github.com/coin-or/pulp/pull/525?

rimaddo avatar Dec 30 '22 11:12 rimaddo