From df5c1cda595e257fc3d3f581c43f6d79e2b20860 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@gmail.com>
Date: Fri, 29 Mar 2019 09:48:25 +0000
Subject: [PATCH] BUG: set correct __file__ when executing script

---
 fsl/utils/fslsub.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsl/utils/fslsub.py b/fsl/utils/fslsub.py
index 2a667e512..d679a3a3a 100644
--- a/fsl/utils/fslsub.py
+++ b/fsl/utils/fslsub.py
@@ -252,7 +252,7 @@ if name_type == 'module':
     func = getattr(import_module(name), func_name)
 elif name_type == 'script':
     # retrieves a function defined in the __main__ script
-    local_execute = {{'__name__': '__not_main__'}}
+    local_execute = {{'__name__': '__not_main__', '__file__': name}}
     exec(open(name, 'r').read(), local_execute)
     func = local_execute[func_name]
 else:
-- 
GitLab