mrirecon / bart

BART: Toolbox for Computational Magnetic Resonance Imaging
https://mrirecon.github.io/bart/
BSD 3-Clause "New" or "Revised" License
291 stars 161 forks source link

bart.py: Print stdout and stderr output from bart call #297

Closed pehses closed 1 year ago

pehses commented 1 year ago

Previously, it was difficult to get access to bart's error codes and messages from python, which is especially relevant for interactive sessions. This patch addresses this issue.

Stdout, stderr, and the error code are stored as function attributes, so that they can be accessed from outside of bart.py.

Example:

from bart import bart bart(0, "pics -h") print("Here's the command output again:") print(bart.stdout)