4 def print_error(*args):
6 args = [str(item) for item in args]
7 sys.stderr.write(" ".join(args) + "\n")
12 if "HOME" in os.environ:
13 return os.path.join(os.environ["HOME"], ".electrum")
14 elif "LOCALAPPDATA" in os.environ:
15 return os.path.join(os.environ["LOCALAPPDATA"], "Electrum")
16 elif "APPDATA" in os.environ:
17 return os.path.join(os.environ["APPDATA"], "Electrum")
19 raise BaseException("No home directory found in environment variables.")
23 """Find the path to the application data directory; add an electrum folder and return path."""
24 if platform.system() == "Windows":
25 return os.path.join(os.environ["APPDATA"], "Electrum")
26 elif platform.system() == "Linux":
27 return os.path.join(sys.prefix, "share", "electrum")
28 elif (platform.system() == "Darwin" or
29 platform.system() == "DragonFly"):
30 return "/Library/Application Support/Electrum"
32 raise Exception("Unknown system")
35 def get_resource_path(*args):
36 return os.path.join(".", *args)
40 """Return path to the data folder."""
42 prefix_path = os.path.dirname(sys.argv[0])
43 local_data = os.path.join(prefix_path, "data")
47 def format_satoshis(x, is_diff=False, num_zeros = 0):
48 from decimal import Decimal
50 sign, digits, exp = s.as_tuple()
51 digits = map(str, digits)
52 while len(digits) < 9:
55 s = ''.join(digits).rstrip('0')
62 s += "0"*( 1 + num_zeros - ( len(s) - p ))
63 s += " "*( 9 - ( len(s) - p ))
64 s = " "*( 5 - ( p )) + s