use python3 in scripts shebang, fix #4519

This commit is contained in:
Janus 2018-07-10 13:49:51 +02:00
parent 586aee45eb
commit 04432fe93e
3 changed files with 8 additions and 3 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# A simple script that connects to a server and displays block headers # A simple script that connects to a server and displays block headers

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python3
import util, json import util, json
peers = util.get_peers() from electrum.network import filter_protocol
peers = filter_protocol(util.get_peers())
results = util.send_request(peers, 'blockchain.estimatefee', [2]) results = util.send_request(peers, 'blockchain.estimatefee', [2])
print(json.dumps(results, indent=4)) print(json.dumps(results, indent=4))

View file

@ -10,6 +10,7 @@ def get_interfaces(servers, timeout=10):
'''Returns a map of servers to connected interfaces. If any '''Returns a map of servers to connected interfaces. If any
connections fail or timeout, they will be missing from the map. connections fail or timeout, they will be missing from the map.
''' '''
assert type(servers) is list
socket_queue = queue.Queue() socket_queue = queue.Queue()
config = SimpleConfig() config = SimpleConfig()
connecting = {} connecting = {}
@ -51,6 +52,9 @@ def get_peers():
peers = {} peers = {}
# 1. get connected interfaces # 1. get connected interfaces
server = config.get('server') server = config.get('server')
if server is None:
print("You need to set a secure server, for example (for mainnet): 'electrum setconfig server helicarrier.bauerj.eu:50002:s'")
return []
interfaces = get_interfaces([server]) interfaces = get_interfaces([server])
if not interfaces: if not interfaces:
print("No connection to", server) print("No connection to", server)