From 7c1cb6d3cb2f5ba3eb298252020a3f03b3d50cd9 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 20 Aug 2018 14:38:45 -0700 Subject: [PATCH] Don't capture stderr when calling conda conda's stderr is *not* guaranteed to be JSON when you are passing --json. We let it bleed through for now. In the longer term, we should capture this separately. Ref #148, which I think is caused by this (along with conda releasing a newer version than what we have) --- tljh/conda.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tljh/conda.py b/tljh/conda.py index e710939..ad66735 100644 --- a/tljh/conda.py +++ b/tljh/conda.py @@ -84,13 +84,15 @@ def ensure_conda_packages(prefix, packages): conda_executable = [os.path.join(prefix, 'bin', 'python'), '-m', 'conda'] abspath = os.path.abspath(prefix) # Let subprocess errors propagate + # Explicitly do *not* capture stderr, since that's not always JSON! + # Scripting conda is a PITA! # FIXME: raise different exception when using raw_output = subprocess.check_output(conda_executable + [ 'install', '-c', 'conda-forge', # Make customizable if we ever need to '--json', '--prefix', abspath - ] + packages, stderr=subprocess.STDOUT).decode() + ] + packages).decode() # `conda install` outputs JSON lines for fetch updates, # and a undelimited output at the end. There is no reasonable way to # parse this outside of this kludge.