tuse portable flag on android instead of explicit path for headers file. use urllib.retrieve() - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 72b4ac97d08a32050fce4be750310be1a7be81cf DIR parent 6b7ad42ec55003324ed6971529898af9bf3307a9 HTML Author: thomasv <thomasv@gitorious> Date: Mon, 17 Dec 2012 17:51:52 +0100 use portable flag on android instead of explicit path for headers file. use urllib.retrieve() Diffstat: M electrum | 2 +- M lib/verifier.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) --- DIR diff --git a/electrum b/electrum t@@ -149,7 +149,7 @@ if __name__ == '__main__': # config is an object passed to the various constructors (wallet, interface, gui) if 'ANDROID_DATA' in os.environ: - config_options = {'wallet_path':"/sdcard/electrum.dat", 'blockchain_headers_path':'/sdcard/sl4a/', 'gui':'android'} + config_options = {'wallet_path':"/sdcard/electrum.dat", 'portable':True, 'verbose':True, 'gui':'android'} else: config_options = eval(str(options)) for k, v in config_options.items(): DIR diff --git a/lib/verifier.py b/lib/verifier.py t@@ -296,15 +296,11 @@ class WalletVerifier(threading.Thread): filename = self.path() if os.path.exists(filename): return - import urllib2 + try: + import urllib print_error("downloading ", self.headers_url ) - f = urllib2.urlopen(self.headers_url) - s = f.read() - f.close() - f = open(filename,'wb+') - f.write(s) - f.close() + urllib.urlretrieve(self.headers_url, filename) except: print_error( "download failed. creating file", filename ) open(filename,'wb+').close()