10 def print_error(*args):
11 if not is_verbose: return
16 args = [str(item) for item in args]
17 sys.stderr.write(" ".join(args) + "\n")
22 if "HOME" in os.environ:
23 return os.path.join(os.environ["HOME"], ".electrum")
24 elif "LOCALAPPDATA" in os.environ:
25 return os.path.join(os.environ["LOCALAPPDATA"], "Electrum")
26 elif "APPDATA" in os.environ:
27 return os.path.join(os.environ["APPDATA"], "Electrum")
29 #raise BaseException("No home directory found in environment variables.")
33 """Find the path to the application data directory; add an electrum folder and return path."""
34 if platform.system() == "Windows":
35 return os.path.join(os.environ["APPDATA"], "Electrum")
36 elif platform.system() == "Linux":
37 return os.path.join(sys.prefix, "share", "electrum")
38 elif (platform.system() == "Darwin" or
39 platform.system() == "DragonFly"):
40 return "/Library/Application Support/Electrum"
42 raise Exception("Unknown system")
45 def get_resource_path(*args):
46 return os.path.join(".", *args)
50 """Return path to the data folder."""
52 prefix_path = os.path.dirname(sys.argv[0])
53 local_data = os.path.join(prefix_path, "data")
57 def format_satoshis(x, is_diff=False, num_zeros = 0):
58 from decimal import Decimal
60 sign, digits, exp = s.as_tuple()
61 digits = map(str, digits)
62 while len(digits) < 9:
65 s = ''.join(digits).rstrip('0')
72 s += "0"*( 1 + num_zeros - ( len(s) - p ))
73 s += " "*( 9 - ( len(s) - p ))
74 s = " "*( 5 - ( p )) + s