URI: 
       tdecode json args after sendind over socket - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 8b7a8b13379612eef6a8e142c69006491811523e
   DIR parent c7f5e3c2d52a3ecbfd1d4e1c226f75a51ed64ec4
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sun, 30 Aug 2015 17:46:51 +0200
       
       decode json args after sendind over socket
       
       Diffstat:
         M electrum                            |      16 +++++++++-------
       
       1 file changed, 9 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/electrum b/electrum
       t@@ -258,6 +258,13 @@ def run_command(config, network, password):
            wallet = Wallet(storage) if cmd.requires_wallet else None
            # arguments passed to function
            args = map(lambda x: config.get(x), cmd.params)
       +    # decode json arguments
       +    def json_decode(x):
       +        try:
       +            return json.loads(x)
       +        except:
       +            return x
       +    args = map(json_decode, args)
            # options
            args += map(lambda x: config.get(x), cmd.options)
        
       t@@ -434,12 +441,7 @@ if __name__ == '__main__':
            for i, arg in enumerate(sys.argv):
                if arg == '-':
                    if not sys.stdin.isatty():
       -                pipe_data = sys.stdin.read()
       -                try:
       -                    pipe_data = json.loads(pipe_data)
       -                except:
       -                    pass
       -                sys.argv[i] = pipe_data
       +                sys.argv[i] = sys.stdin.read()
                        break
                    else:
                        raise BaseException('Cannot get argument from stdin')
       t@@ -506,7 +508,7 @@ if __name__ == '__main__':
                if type(result) in [str, unicode]:
                    print_msg(result)
                elif result is not None:
       -            if result.get('error'):
       +            if type(result) is dir and result.get('error'):
                        print_stderr(result.get('error'))
                    else:
                        print_json(result)