diff --git a/fsl/utils/settings.py b/fsl/utils/settings.py
index 87b6c9ce6a5bc0cb34d777ce0e2b8245a7492922..9993a1478792fc932af2080421cd85e26d0c87ae 100644
--- a/fsl/utils/settings.py
+++ b/fsl/utils/settings.py
@@ -14,6 +14,9 @@ def read(name, default=None):
     try:    import wx
     except: return None
 
+    if wx.GetApp() is None:
+        return None
+
     config = wx.Config('fsleyes')
     
     value = config.Read(name)
@@ -28,7 +31,10 @@ def read(name, default=None):
 def write(name, value):
 
     try:    import wx
-    except: return None    
+    except: return
+
+    if wx.GetApp() is None:
+        return 
 
     value  = str(value)
     config = wx.Config('fsleyes')