# Error response function

**URL:** <https://community.mrtrix.org/t/error-response-function/393>\
**Category:** Uncategorized\
**Created:** [August 16, 2016, 11:19pm UTC](https://community.mrtrix.org/t/error-response-function/393 "2016-08-16T23:19:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mblesac](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mblesac/32/2210_2.png) [@mblesac](https://community.mrtrix.org/u/mblesac)\
**Post date:** [August 16, 2016, 11:19pm UTC](https://community.mrtrix.org/t/error-response-function/393/1 "2016-08-16T23:19:21Z")

</div>

Dear all,

I’m running the script dwi2response and I get and error, but I don’t know what it fails.

```bash
dwi2response tournier 7101.mif 7101_response.txt

dwi2response: 
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response: 
dwi2response: Generated temporary directory: /tmp/dwi2response-tmp-NIB609/
Command: mrconvert /media/manuel/6abbdb9a-052b-4aa4-9335-dd6bdc507d9f/bmanuel/TRACTOGRAPHY/RAW-DATA/DIFF/7101.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-NIB609/dwi.mif
dwi2response: 
dwi2response: [ERROR] Command failed: mrconvert /media/manuel/6abbdb9a-052b-4aa4-9335-dd6bdc507d9f/bmanuel/TRACTOGRAPHY/RAW-DATA/DIFF/7101.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-NIB609/dwi.mif
dwi2response: Output of failed command:
dwi2response: Changing back to original directory (/media/manuel/6abbdb9a-052b-4aa4-9335-dd6bdc507d9f/bmanuel/TRACTOGRAPHY/RAW-DATA/DIFF)
dwi2response: Deleting temporary directory /tmp/dwi2response-tmp-NIB609/

```

Any clue? Thanks in advance

Regards,

Manuel

---

<div class="post-metadata">

**Author:** ![ThijsDhollander](https://community.mrtrix.org/user_avatar/community.mrtrix.org/thijsdhollander/32/1617_2.png) [@ThijsDhollander](https://community.mrtrix.org/u/ThijsDhollander)\
**Post date:** [August 16, 2016, 11:46pm UTC](https://community.mrtrix.org/t/error-response-function/393/2 "2016-08-16T23:46:28Z")

</div>

Hi @mblesac,

Could you copy-paste and run this line, and tell us what the output is?

```auto
mrconvert /media/manuel/6abbdb9a-052b-4aa4-9335-dd6bdc507d9f/bmanuel/TRACTOGRAPHY/RAW-DATA/DIFF/7101.mif - -stride 0,0,0,1 | dwiextract - test.mif

```

That should give you / us some insight into what the actual problem is at that very first step of the script!

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [August 17, 2016, 12:04am UTC](https://community.mrtrix.org/t/error-response-function/393/3 "2016-08-17T00:04:24Z")

</div>

I’d be suspecting an out of RAM problem, similar to [this thread](https://community.mrtrix.org/t/dwi2response-with-tournier/294?u=jdtournier). How big is your image? How much RAM do you have on the system? And how much space in `/tmp`?

---

<div class="post-metadata">

**Author:** ![mblesac](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mblesac/32/2210_2.png) [@mblesac](https://community.mrtrix.org/u/mblesac)\
**Post date:** [August 17, 2016, 12:25am UTC](https://community.mrtrix.org/t/error-response-function/393/4 "2016-08-17T00:25:16Z")

</div>

I think that’s right, is some memory issue, because when I run mrconvert it works without any problem.

My images are 4GB, in /tmp I have 11.8 (I think here is the problem) and the RAM is 66GB

---

<div class="post-metadata">

**Author:** ![mblesac](https://community.mrtrix.org/user_avatar/community.mrtrix.org/mblesac/32/2210_2.png) [@mblesac](https://community.mrtrix.org/u/mblesac)\
**Post date:** [August 17, 2016, 12:37am UTC](https://community.mrtrix.org/t/error-response-function/393/5 "2016-08-17T00:37:59Z")

</div>

That was the problem, I changed the output directory to another hard drive and now works perfect. Thanks!

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [August 17, 2016, 3:18am UTC](https://community.mrtrix.org/t/error-response-function/393/6 "2016-08-17T03:18:27Z")

</div>

Good to know!

I did a little more digging, since I was curious as to why both here and in [another thread](https://community.mrtrix.org/t/error-of-running-population-template/395) the script isn’t capturing any of the terminal output from the unsuccessful command:

`dwi2response: Output of failed command:`  
_tumbleweed appears on terminal_  
😞

The problem is that when the fatal error occurs, the relevant (non-_MRtrix3_) library doesn’t write the error to the command’s standard error output, but to the current `tty` terminal. As a result, due to the mechanism used by the Python script library for calling these commands, the script library fails to capture this text, leaving you with an empty error message and a confused look. (Mind you, even if it were printed, the error message itself isn’t that clear: ‘`Bus Error (core dumped)`’)

I’m trying to fix this so that the script can give a more informative error; but for now, if “Output of failed command” is empty, there’s a good chance that you’ve run out of memory.

Rob
