Skip to content

Commit

Permalink
suppress stderr when detecting esolver
Browse files Browse the repository at this point in the history
Caused noisy and unnecessary warning messages. Fixes #141
  • Loading branch information
aebrahim committed Jan 16, 2015
1 parent d62e594 commit 526bb3e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cobra/solvers/esolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@

from . import cglpk

try:
ESOLVER_COMMAND = check_output(["which", "esolver"]).strip()
with open(devnull, "w") as DEVNULL:
with open(devnull, "w") as DEVNULL:
try:
ESOLVER_COMMAND = check_output(["which", "esolver"],
stderr=DEVNULL).strip()
__esolver_version__ = check_output(["esolver", "-v"], stderr=DEVNULL)
del DEVNULL
except CalledProcessError:
raise RuntimeError("esolver command not found")
try:
GZIP_COMMAND = check_output(["which", "gzip"]).strip()
except CalledProcessError:
raise RuntimeError("gzip command not found")
except CalledProcessError:
raise RuntimeError("esolver command not found")
try:
GZIP_COMMAND = check_output(["which", "gzip"], stderr=DEVNULL).strip()
except CalledProcessError:
raise RuntimeError("gzip command not found")
del DEVNULL

solver_name = "esolver"

Expand Down

0 comments on commit 526bb3e

Please sign in to comment.