From adaf7bbbdab7c9d0b0d6eb207f0e0c8b05e2f364 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 13 Dec 2017 18:37:12 +1030
Subject: [PATCH] subprocess.DEVNULL only exists in python >= 3.3

---
 fsl/data/dicom.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fsl/data/dicom.py b/fsl/data/dicom.py
index b717c7f5a..bf1bb5de4 100644
--- a/fsl/data/dicom.py
+++ b/fsl/data/dicom.py
@@ -25,6 +25,7 @@ wrappers around functionality provided by Chris Rorden's ``dcm2niix`` program:
 """
 
 
+import               os
 import os.path    as op
 import subprocess as sp
 import               re
@@ -156,7 +157,8 @@ def scanDir(dcmdir):
 
     with tempdir.tempdir() as td:
 
-        sp.call(cmd.split(), stdout=sp.DEVNULL, stderr=sp.DEVNULL)
+        with open(os.devnull, 'wb') as devnull:
+            sp.call(cmd.split(), stdout=devnull, stderr=devnull)
 
         files = glob.glob(op.join(td, '*.json'))
 
@@ -200,7 +202,8 @@ def loadSeries(series):
 
     with tempdir.tempdir() as td:
 
-        sp.call(cmd.split(), stdout=sp.DEVNULL, stderr=sp.DEVNULL)
+        with open(os.devnull, 'wb') as devnull:
+            sp.call(cmd.split(), stdout=devnull, stderr=devnull)
 
         files  = glob.glob(op.join(td, '{}.nii'.format(snum)))
         images = [nib.load(f, mmap=False) for f in files]
-- 
GitLab