electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit d4d93b39285856209b4bd0e3500868e6b936f9a6
parent 66c928572ae259598ad04d7aed8980ad73cc16ea
Author: Johann Bauer <bauerj@bauerj.eu>
Date:   Sat, 25 Feb 2017 12:25:57 +0100

Various fixes in util.py

Diffstat:
Mlib/util.py | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/util.py b/lib/util.py @@ -27,14 +27,13 @@ from __future__ import unicode_literals import binascii import os, sys, re, json -import platform -import shutil from collections import defaultdict from datetime import datetime from decimal import Decimal import traceback import urllib import threading + from .i18n import _ import six @@ -601,7 +600,7 @@ def create_URI(addr, amount, message): if amount: query.append('amount=%s'%format_satoshis_plain(amount)) if message: - if type(message) == unicode: + if six.PY2 and type(message) == unicode: message = message.encode('utf8') query.append('message=%s'%urllib.quote(message)) p = urllib_parse.ParseResult(scheme='bitcoin', netloc='', path=addr, params='', query='&'.join(query), fragment='') @@ -726,14 +725,14 @@ class SocketPipe: class QueuePipe: def __init__(self, send_queue=None, get_queue=None): - self.send_queue = send_queue if send_queue else Queue.Queue() - self.get_queue = get_queue if get_queue else Queue.Queue() + self.send_queue = send_queue if send_queue else queue.Queue() + self.get_queue = get_queue if get_queue else queue.Queue() self.set_timeout(0.1) def get(self): try: return self.get_queue.get(timeout=self.timeout) - except Queue.Empty: + except queue.Empty: raise timeout def get_all(self): @@ -742,7 +741,7 @@ class QueuePipe: try: r = self.get_queue.get_nowait() responses.append(r) - except Queue.Empty: + except queue.Empty: break return responses @@ -778,4 +777,4 @@ def check_www_dir(rdir): path = os.path.join(rdir, filename) if not os.path.exists(path): print_error("downloading ", URL) - urllib.urlretrieve(URL, path) + urllib.request.urlretrieve(URL, path)