Ignore errors on ASL solver version check#3298
Ignore errors on ASL solver version check#3298mrmundt merged 4 commits intoPyomo:mainfrom alma-walmsley:main
Conversation
jsiirola
left a comment
There was a problem hiding this comment.
This looks good. It would be nice if we had a way of testing this (i.e., testing against solvers compiled in any LOCALE other than en_US - as this is not the first time we have hit issues running in languages other than English), but I don't think that should prevent merging.
We should also consider changing the universal_newlines=True to test=True in that subprocess.run() call (text is the documented argument, and universal_newlines is now being provided for backwards compatibility).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3298 +/- ##
=======================================
Coverage 88.46% 88.46%
=======================================
Files 867 867
Lines 98218 98218
=======================================
+ Hits 86886 86887 +1
+ Misses 11332 11331 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Fixes # .
Summary/Motivation:
Trying to run the
couennesolver executable through Pyomo throws an error. Pyomo tries to check the version of the executable specified to verify that the solver can be run. In couenne's case, runningcouenne -vreturnscouenne (Microsoft cl 15.00.21022.08 für 80x86), ASL(20100130), except theüruns into a problem with default encoding / utf-8 and cannot be decoded. This throws an error in the subprocess call which is not caught and so the solver cannot be run. Note that this problem is not necessarily couenne specific, but rather due tosubprocessexpecting the data in a text format where special characters likeücould not be recognised.To reproduce, for example:
Changes proposed in this PR:
errors='ignore'to the ASL solver version check subprocess call. This will ignore any errors while trying to decode the data received from the-vcommand (ie. errors arising from special characters, unexpected bytes, etc). After all, Pyomo does not care about the value of the solver version; the version check appears to only verify the solver exists before attempting to solve - Seeopt/base/solvers.pyandsolvers/plugins/solvers/ASL.pyfor more details. You can also read about theerrorsargument tosubprocesshere: https://docs.python.org/3.10/library/io.html#io.TextIOWrapperLegal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: