various bugfixes for imported addresses
[electrum-nvc.git] / lib / simple_config.py
index e3614f5..30c7f9d 100644 (file)
@@ -3,9 +3,18 @@ import ast
 import threading
 import os
 
-from util import user_dir, print_error
+from util import user_dir, print_error, print_msg
 
 
+config = None
+def get_config():
+    global config
+    return config
+
+def set_config(c):
+    global config
+    config = c
+
 
 class SimpleConfig:
     """
@@ -30,10 +39,9 @@ a SimpleConfig instance then reads the wallet file.
 
         # user conf, writeable
         self.user_config = {}
-        if options.get('portable') == False:
-            self.read_user_config()
-
+        self.read_user_config()
 
+        set_config(self)
 
 
 
@@ -103,7 +111,7 @@ a SimpleConfig instance then reads the wallet file.
             import ast
             try:
                 out = ast.literal_eval(out)
-            except:
+            except Exception:
                 print "type error for '%s': using default value"%key
                 out = default
 
@@ -154,8 +162,9 @@ a SimpleConfig instance then reads the wallet file.
                 return
             try:
                 d = ast.literal_eval( data )  #parse raw data from reading wallet file
-            except:
-                raise IOError("Cannot read config file.")
+            except Exception:
+                print_msg("Error: Cannot read config file.")
+                return
 
             self.user_config = d