Skip to content

Commit

Permalink
utf-8: more debug output when decoding fails (#66)
Browse files Browse the repository at this point in the history
Now the output includes a representation of the byte sequence that could
not be decoded, which aids debugging.
  • Loading branch information
olupton authored Dec 12, 2022
1 parent 601266c commit 962ec51
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modeldb/modelrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ def run_neuron_cmds(model, cmds):
cmds,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
cwd=model.run_info["start_dir"],
)
out, _ = sp.communicate()

model.nrn_run.extend(curate_log_string(model, out).split('\n'))
try:
out = out.decode("utf-8")
except UnicodeDecodeError:
raise Exception("Could not decode output:" + repr(out))
model.nrn_run.extend(curate_log_string(model, out).splitlines())
if sp.returncode > 1:
model._nrn_run_error = True

Expand Down

0 comments on commit 962ec51

Please sign in to comment.