1
0

Various fixes for command line. Make 'payto' command require network (fixes #1525)

This commit is contained in:
ThomasV
2015-10-29 11:06:09 +01:00
parent 079cb311ec
commit bb7b0884e3
8 changed files with 36 additions and 33 deletions

View File

@@ -112,14 +112,18 @@ def print_msg(*args):
sys.stdout.write(" ".join(args) + "\n")
sys.stdout.flush()
def print_json(obj):
def json_encode(obj):
try:
s = json.dumps(obj, sort_keys = True, indent = 4, cls=MyEncoder)
except TypeError:
s = repr(obj)
sys.stdout.write(s + "\n")
sys.stdout.flush()
return s
def json_decode(x):
try:
return json.loads(x)
except:
return x
# decorator that prints execution time
def profiler(func):