Merge pull request #388 from WyseNynja/fix_more_bare_except
fix more bare excepts
This commit is contained in:
commit
5be9b7c669
4
electrum
4
electrum
|
@ -215,7 +215,7 @@ if __name__ == '__main__':
|
||||||
seed = getpass.getpass(prompt = "seed:", stream = None) if options.concealed else raw_input("seed:")
|
seed = getpass.getpass(prompt = "seed:", stream = None) if options.concealed else raw_input("seed:")
|
||||||
try:
|
try:
|
||||||
seed.decode('hex')
|
seed.decode('hex')
|
||||||
except:
|
except Exception:
|
||||||
print_error("Warning: Not hex, trying decode.")
|
print_error("Warning: Not hex, trying decode.")
|
||||||
seed = mnemonic_decode( seed.split(' ') )
|
seed = mnemonic_decode( seed.split(' ') )
|
||||||
if not seed:
|
if not seed:
|
||||||
|
@ -274,7 +274,7 @@ if __name__ == '__main__':
|
||||||
# check password
|
# check password
|
||||||
try:
|
try:
|
||||||
seed = wallet.get_seed(password)
|
seed = wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
print_msg("Error: This password does not decode this wallet.")
|
print_msg("Error: This password does not decode this wallet.")
|
||||||
exit(1)
|
exit(1)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -345,7 +345,7 @@ def get_history_values(n):
|
||||||
time_str = str( dt.time() )
|
time_str = str( dt.time() )
|
||||||
else:
|
else:
|
||||||
time_str = str( dt.date() )
|
time_str = str( dt.date() )
|
||||||
except:
|
except Exception:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
|
|
||||||
conf_str = 'v' if conf else 'o'
|
conf_str = 'v' if conf else 'o'
|
||||||
|
@ -600,7 +600,7 @@ def payto_loop():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
amount = int( 100000000 * Decimal(amount) )
|
amount = int( 100000000 * Decimal(amount) )
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('Error','Invalid amount')
|
modal_dialog('Error','Invalid amount')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ def show_seed():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
seed = wallet.get_seed(password)
|
seed = wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('error','incorrect password')
|
modal_dialog('error','incorrect password')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ def change_password_dialog():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wallet.get_seed(password)
|
wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('error','incorrect password')
|
modal_dialog('error','incorrect password')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -811,7 +811,7 @@ def settings_loop():
|
||||||
if fee:
|
if fee:
|
||||||
try:
|
try:
|
||||||
fee = int( 100000000 * Decimal(fee) )
|
fee = int( 100000000 * Decimal(fee) )
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('error','invalid fee value')
|
modal_dialog('error','invalid fee value')
|
||||||
wallet.set_fee(fee)
|
wallet.set_fee(fee)
|
||||||
set_listview()
|
set_listview()
|
||||||
|
@ -828,7 +828,7 @@ def settings_loop():
|
||||||
auto_connect = False
|
auto_connect = False
|
||||||
try:
|
try:
|
||||||
network.set_parameters(host, port, protocol, proxy, auto_connect)
|
network.set_parameters(host, port, protocol, proxy, auto_connect)
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('error','invalid server')
|
modal_dialog('error','invalid server')
|
||||||
set_listview()
|
set_listview()
|
||||||
|
|
||||||
|
@ -987,7 +987,7 @@ class ElectrumGui:
|
||||||
m = modal_input('Mnemonic','please enter your code')
|
m = modal_input('Mnemonic','please enter your code')
|
||||||
try:
|
try:
|
||||||
seed = mnemonic_decode(m.split(' '))
|
seed = mnemonic_decode(m.split(' '))
|
||||||
except:
|
except Exception:
|
||||||
modal_dialog('error: could not decode this seed')
|
modal_dialog('error: could not decode this seed')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
24
gui/gtk.py
24
gui/gtk.py
|
@ -51,12 +51,12 @@ def numbify(entry, is_int = False):
|
||||||
s = s[:p] + '.' + s[p:p+8]
|
s = s[:p] + '.' + s[p:p+8]
|
||||||
try:
|
try:
|
||||||
amount = int( Decimal(s) * 100000000 )
|
amount = int( Decimal(s) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
amount = None
|
amount = None
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
amount = int( s )
|
amount = int( s )
|
||||||
except:
|
except Exception:
|
||||||
amount = None
|
amount = None
|
||||||
entry.set_text(s)
|
entry.set_text(s)
|
||||||
return amount
|
return amount
|
||||||
|
@ -70,7 +70,7 @@ def show_seed_dialog(wallet, password, parent):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
seed = wallet.get_seed(password)
|
seed = wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
show_message("Incorrect password")
|
show_message("Incorrect password")
|
||||||
return
|
return
|
||||||
dialog = gtk.MessageDialog(
|
dialog = gtk.MessageDialog(
|
||||||
|
@ -140,7 +140,7 @@ def run_recovery_dialog():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
seed.decode('hex')
|
seed.decode('hex')
|
||||||
except:
|
except Exception:
|
||||||
print_error("Warning: Not hex, trying decode")
|
print_error("Warning: Not hex, trying decode")
|
||||||
seed = mnemonic.mn_decode( seed.split(' ') )
|
seed = mnemonic.mn_decode( seed.split(' ') )
|
||||||
if not seed:
|
if not seed:
|
||||||
|
@ -209,7 +209,7 @@ def run_settings_dialog(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fee = int( 100000000 * Decimal(fee) )
|
fee = int( 100000000 * Decimal(fee) )
|
||||||
except:
|
except Exception:
|
||||||
show_message("error")
|
show_message("error")
|
||||||
return
|
return
|
||||||
self.wallet.set_fee(fee)
|
self.wallet.set_fee(fee)
|
||||||
|
@ -217,7 +217,7 @@ def run_settings_dialog(self):
|
||||||
try:
|
try:
|
||||||
nz = int( nz )
|
nz = int( nz )
|
||||||
if nz>8: nz = 8
|
if nz>8: nz = 8
|
||||||
except:
|
except Exception:
|
||||||
show_message("error")
|
show_message("error")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ def run_network_dialog( network, parent ):
|
||||||
proxy = network.config.get('proxy')
|
proxy = network.config.get('proxy')
|
||||||
auto_connect = network.config.get('auto_cycle')
|
auto_connect = network.config.get('auto_cycle')
|
||||||
network.set_parameters(host, port, protocol, proxy, auto_connect)
|
network.set_parameters(host, port, protocol, proxy, auto_connect)
|
||||||
except:
|
except Exception:
|
||||||
show_message("error:" + server)
|
show_message("error:" + server)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ def change_password_dialog(wallet, parent, icon):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wallet.get_seed(password)
|
wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
show_message("Incorrect password")
|
show_message("Incorrect password")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ class ElectrumWindow:
|
||||||
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
|
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
|
||||||
try:
|
try:
|
||||||
to_address = self.wallet.get_alias(r, interactive=False)
|
to_address = self.wallet.get_alias(r, interactive=False)
|
||||||
except:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
if to_address:
|
if to_address:
|
||||||
s = r + ' <' + to_address + '>'
|
s = r + ' <' + to_address + '>'
|
||||||
|
@ -789,12 +789,12 @@ class ElectrumWindow:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
amount = int( Decimal(amount_entry.get_text()) * 100000000 )
|
amount = int( Decimal(amount_entry.get_text()) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
self.show_message( "invalid amount")
|
self.show_message( "invalid amount")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
fee = int( Decimal(fee_entry.get_text()) * 100000000 )
|
fee = int( Decimal(fee_entry.get_text()) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
self.show_message( "invalid fee")
|
self.show_message( "invalid fee")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1168,7 +1168,7 @@ class ElectrumWindow:
|
||||||
if conf > 0:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except Exception:
|
||||||
time_str = "------"
|
time_str = "------"
|
||||||
conf_icon = gtk.STOCK_APPLY
|
conf_icon = gtk.STOCK_APPLY
|
||||||
elif conf == -1:
|
elif conf == -1:
|
||||||
|
|
|
@ -26,7 +26,7 @@ import shutil
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import PyQt4
|
import PyQt4
|
||||||
except:
|
except Exception:
|
||||||
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
||||||
|
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
|
@ -39,7 +39,7 @@ from electrum.bitcoin import MIN_RELAY_TX_FEE
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import icons_rc
|
import icons_rc
|
||||||
except:
|
except Exception:
|
||||||
sys.exit("Error: Could not import icons_rc.py, please generate it with: 'pyrcc4 icons.qrc -o gui/qt/icons_rc.py'")
|
sys.exit("Error: Could not import icons_rc.py, please generate it with: 'pyrcc4 icons.qrc -o gui/qt/icons_rc.py'")
|
||||||
|
|
||||||
from util import *
|
from util import *
|
||||||
|
|
|
@ -219,7 +219,7 @@ class Console(QtGui.QPlainTextEdit):
|
||||||
exec command in self.namespace
|
exec command in self.namespace
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
self.close()
|
self.close()
|
||||||
except:
|
except Exception:
|
||||||
traceback_lines = traceback.format_exc().split('\n')
|
traceback_lines = traceback.format_exc().split('\n')
|
||||||
# Remove traceback mentioning this file, and a linebreak
|
# Remove traceback mentioning this file, and a linebreak
|
||||||
for i in (3,2,1,-1):
|
for i in (3,2,1,-1):
|
||||||
|
|
|
@ -284,7 +284,7 @@ class InstallWizard(QDialog):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
wallet.init_seed(seed)
|
wallet.init_seed(seed)
|
||||||
except:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
QMessageBox.warning(None, _('Error'), _('Incorrect seed'), _('OK'))
|
QMessageBox.warning(None, _('Error'), _('Incorrect seed'), _('OK'))
|
||||||
|
|
|
@ -690,7 +690,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
if conf > 0:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except Exception:
|
||||||
time_str = _("error")
|
time_str = _("error")
|
||||||
|
|
||||||
if conf == -1:
|
if conf == -1:
|
||||||
|
@ -872,12 +872,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
amount = self.read_amount(unicode( self.amount_e.text()))
|
amount = self.read_amount(unicode( self.amount_e.text()))
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid Amount'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Invalid Amount'), _('OK'))
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
fee = self.read_amount(unicode( self.fee_e.text()))
|
fee = self.read_amount(unicode( self.fee_e.text()))
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid Fee'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Invalid Fee'), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -923,7 +923,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
with open(fileName,'w') as f:
|
with open(fileName,'w') as f:
|
||||||
f.write(json.dumps(tx.as_dict(),indent=4) + '\n')
|
f.write(json.dumps(tx.as_dict(),indent=4) + '\n')
|
||||||
QMessageBox.information(self, _('Unsigned transaction created'), _("Unsigned transaction was saved to file:") + " " +fileName, _('OK'))
|
QMessageBox.information(self, _('Unsigned transaction created'), _("Unsigned transaction was saved to file:") + " " +fileName, _('OK'))
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Could not write transaction to file'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Could not write transaction to file'), _('OK'))
|
||||||
|
|
||||||
# add recipient to addressbook
|
# add recipient to addressbook
|
||||||
|
@ -1559,7 +1559,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
if self.wallet.seed:
|
if self.wallet.seed:
|
||||||
try:
|
try:
|
||||||
mnemonic = self.wallet.get_mnemonic(password)
|
mnemonic = self.wallet.get_mnemonic(password)
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
|
||||||
return
|
return
|
||||||
from seed_dialog import SeedDialog
|
from seed_dialog import SeedDialog
|
||||||
|
@ -1781,7 +1781,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
txt.decode('hex')
|
txt.decode('hex')
|
||||||
tx = Transaction(txt)
|
tx = Transaction(txt)
|
||||||
return tx
|
return tx
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1794,7 +1794,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
input_info = json.loads(tx_dict['input_info'])
|
input_info = json.loads(tx_dict['input_info'])
|
||||||
tx.add_input_info(input_info)
|
tx.add_input_info(input_info)
|
||||||
return tx
|
return tx
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
QMessageBox.critical(None, _("Unable to parse transaction"), _("Electrum was unable to parse your transaction"))
|
QMessageBox.critical(None, _("Unable to parse transaction"), _("Electrum was unable to parse your transaction"))
|
||||||
|
@ -1991,7 +1991,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
lang_combo.addItems(languages.values())
|
lang_combo.addItems(languages.values())
|
||||||
try:
|
try:
|
||||||
index = languages.keys().index(self.config.get("language",''))
|
index = languages.keys().index(self.config.get("language",''))
|
||||||
except:
|
except Exception:
|
||||||
index = 0
|
index = 0
|
||||||
lang_combo.setCurrentIndex(index)
|
lang_combo.setCurrentIndex(index)
|
||||||
grid.addWidget(lang_combo, 1, 1)
|
grid.addWidget(lang_combo, 1, 1)
|
||||||
|
@ -2040,7 +2040,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
fee = unicode(fee_e.text())
|
fee = unicode(fee_e.text())
|
||||||
try:
|
try:
|
||||||
fee = self.read_amount(fee)
|
fee = self.read_amount(fee)
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid value') +': %s'%fee, _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Invalid value') +': %s'%fee, _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2050,7 +2050,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
try:
|
try:
|
||||||
nz = int( nz )
|
nz = int( nz )
|
||||||
if nz>8: nz=8
|
if nz>8: nz=8
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self, _('Error'), _('Invalid value')+':%s'%nz, _('OK'))
|
QMessageBox.warning(self, _('Error'), _('Invalid value')+':%s'%nz, _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2146,7 +2146,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
w = None
|
w = None
|
||||||
cb.clicked.connect(mk_toggle(cb,p,w))
|
cb.clicked.connect(mk_toggle(cb,p,w))
|
||||||
grid.addWidget(HelpButton(p.description()), i, 2)
|
grid.addWidget(HelpButton(p.description()), i, 2)
|
||||||
except:
|
except Exception:
|
||||||
print_msg(_("Error: cannot display plugin"), p)
|
print_msg(_("Error: cannot display plugin"), p)
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
grid.setRowStretch(i+1,1)
|
grid.setRowStretch(i+1,1)
|
||||||
|
|
|
@ -85,7 +85,7 @@ def run_password_dialog(self, wallet, parent):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wallet.get_seed(password)
|
wallet.get_seed(password)
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(parent, _('Error'), _('Incorrect Password'), _('OK'))
|
QMessageBox.warning(parent, _('Error'), _('Incorrect Password'), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ def run_password_dialog(self, wallet, parent):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wallet.update_password(password, new_password)
|
wallet.update_password(password, new_password)
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(parent, _('Error'), _('Failed to update password'), _('OK'))
|
QMessageBox.warning(parent, _('Error'), _('Failed to update password'), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class QRCodeWidget(QWidget):
|
||||||
self.qr.addData(self.addr)
|
self.qr.addData(self.addr)
|
||||||
self.qr.make()
|
self.qr.make()
|
||||||
break
|
break
|
||||||
except:
|
except Exception:
|
||||||
self.qr=None
|
self.qr=None
|
||||||
continue
|
continue
|
||||||
self.update()
|
self.update()
|
||||||
|
|
|
@ -26,7 +26,7 @@ import StringIO
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import PyQt4
|
import PyQt4
|
||||||
except:
|
except Exception:
|
||||||
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
||||||
|
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
|
|
|
@ -104,7 +104,7 @@ class ElectrumGui:
|
||||||
if confirmations:
|
if confirmations:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except Exception:
|
||||||
time_str = "unknown"
|
time_str = "unknown"
|
||||||
else:
|
else:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
|
@ -175,12 +175,12 @@ class ElectrumGui:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
amount = int( Decimal( self.str_amount) * 100000000 )
|
amount = int( Decimal( self.str_amount) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
print(_('Invalid Amount'))
|
print(_('Invalid Amount'))
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
fee = int( Decimal( self.str_fee) * 100000000 )
|
fee = int( Decimal( self.str_fee) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
print(_('Invalid Fee'))
|
print(_('Invalid Fee'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
12
gui/text.py
12
gui/text.py
|
@ -64,7 +64,7 @@ class ElectrumGui:
|
||||||
def set_cursor(self, x):
|
def set_cursor(self, x):
|
||||||
try:
|
try:
|
||||||
curses.curs_set(x)
|
curses.curs_set(x)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def restore_or_create(self):
|
def restore_or_create(self):
|
||||||
|
@ -112,7 +112,7 @@ class ElectrumGui:
|
||||||
if conf:
|
if conf:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except Exception:
|
||||||
time_str = "------"
|
time_str = "------"
|
||||||
else:
|
else:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
|
@ -291,12 +291,12 @@ class ElectrumGui:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
amount = int( Decimal( self.str_amount) * 100000000 )
|
amount = int( Decimal( self.str_amount) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
self.show_message(_('Invalid Amount'))
|
self.show_message(_('Invalid Amount'))
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
fee = int( Decimal( self.str_fee) * 100000000 )
|
fee = int( Decimal( self.str_fee) * 100000000 )
|
||||||
except:
|
except Exception:
|
||||||
self.show_message(_('Invalid Fee'))
|
self.show_message(_('Invalid Fee'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ class ElectrumGui:
|
||||||
if not auto_connect:
|
if not auto_connect:
|
||||||
try:
|
try:
|
||||||
host, port, protocol = server.split(':')
|
host, port, protocol = server.split(':')
|
||||||
except:
|
except Exception:
|
||||||
self.show_message("Error:" + server + "\nIn doubt, type \"auto-connect\"")
|
self.show_message("Error:" + server + "\nIn doubt, type \"auto-connect\"")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ class ElectrumGui:
|
||||||
choices = item.get('choices')
|
choices = item.get('choices')
|
||||||
try:
|
try:
|
||||||
j = choices.index(item.get('value'))
|
j = choices.index(item.get('value'))
|
||||||
except:
|
except Exception:
|
||||||
j = 0
|
j = 0
|
||||||
new_choice = choices[(j + 1)% len(choices)]
|
new_choice = choices[(j + 1)% len(choices)]
|
||||||
item['value'] = new_choice
|
item['value'] = new_choice
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Plugin(BasePlugin):
|
||||||
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
|
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
|
||||||
try:
|
try:
|
||||||
to_address = self.get_alias(r, True, self.gui.show_message, self.gui.question)
|
to_address = self.get_alias(r, True, self.gui.show_message, self.gui.question)
|
||||||
except:
|
except Exception:
|
||||||
return
|
return
|
||||||
if to_address:
|
if to_address:
|
||||||
s = r + ' <' + to_address + '>'
|
s = r + ' <' + to_address + '>'
|
||||||
|
@ -103,7 +103,7 @@ class Plugin(BasePlugin):
|
||||||
return ''
|
return ''
|
||||||
try:
|
try:
|
||||||
lines = urllib.urlopen(url).readlines()
|
lines = urllib.urlopen(url).readlines()
|
||||||
except:
|
except Exception:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
# line 0
|
# line 0
|
||||||
|
@ -147,7 +147,7 @@ class Plugin(BasePlugin):
|
||||||
try:
|
try:
|
||||||
EC_KEY.verify_message(signing_address, signature, url )
|
EC_KEY.verify_message(signing_address, signature, url )
|
||||||
self.receipt = (signing_address, signature, url)
|
self.receipt = (signing_address, signature, url)
|
||||||
except:
|
except Exception:
|
||||||
show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.')
|
show_message('Warning: the URI contains a bad signature.\nThe identity of the recipient cannot be verified.')
|
||||||
address = amount = label = identity = message = ''
|
address = amount = label = identity = message = ''
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,14 @@ class Exchanger(threading.Thread):
|
||||||
try:
|
try:
|
||||||
connection = httplib.HTTPConnection('blockchain.info')
|
connection = httplib.HTTPConnection('blockchain.info')
|
||||||
connection.request("GET", "/ticker")
|
connection.request("GET", "/ticker")
|
||||||
except:
|
except Exception:
|
||||||
return
|
return
|
||||||
response = connection.getresponse()
|
response = connection.getresponse()
|
||||||
if response.reason == httplib.responses[httplib.NOT_FOUND]:
|
if response.reason == httplib.responses[httplib.NOT_FOUND]:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
response = json.loads(response.read())
|
response = json.loads(response.read())
|
||||||
except:
|
except Exception:
|
||||||
return
|
return
|
||||||
quote_currencies = {}
|
quote_currencies = {}
|
||||||
try:
|
try:
|
||||||
|
@ -122,12 +122,12 @@ class Plugin(BasePlugin):
|
||||||
def set_currencies(combo):
|
def set_currencies(combo):
|
||||||
try:
|
try:
|
||||||
combo.clear()
|
combo.clear()
|
||||||
except:
|
except Exception:
|
||||||
return
|
return
|
||||||
combo.addItems(self.currencies)
|
combo.addItems(self.currencies)
|
||||||
try:
|
try:
|
||||||
index = self.currencies.index(self.config.get('currency', "EUR"))
|
index = self.currencies.index(self.config.get('currency', "EUR"))
|
||||||
except:
|
except Exception:
|
||||||
index = 0
|
index = 0
|
||||||
combo.setCurrentIndex(index)
|
combo.setCurrentIndex(index)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import json
|
||||||
from urlparse import urlparse, parse_qs
|
from urlparse import urlparse, parse_qs
|
||||||
try:
|
try:
|
||||||
import PyQt4
|
import PyQt4
|
||||||
except:
|
except Exception:
|
||||||
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
sys.exit("Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'")
|
||||||
|
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
|
|
|
@ -165,7 +165,7 @@ class Plugin(BasePlugin):
|
||||||
def update_receive_item(self, address, item):
|
def update_receive_item(self, address, item):
|
||||||
try:
|
try:
|
||||||
amount, currency = self.requested_amounts.get(address, (None, None))
|
amount, currency = self.requested_amounts.get(address, (None, None))
|
||||||
except:
|
except Exception:
|
||||||
print "cannot get requested amount", address, self.requested_amounts.get(address)
|
print "cannot get requested amount", address, self.requested_amounts.get(address)
|
||||||
amount, currency = None, None
|
amount, currency = None, None
|
||||||
self.requested_amounts.pop(address)
|
self.requested_amounts.pop(address)
|
||||||
|
@ -183,7 +183,7 @@ class Plugin(BasePlugin):
|
||||||
label = self.wallet.labels.get(address)
|
label = self.wallet.labels.get(address)
|
||||||
try:
|
try:
|
||||||
amount, currency = self.requested_amounts.get(address, (None, None))
|
amount, currency = self.requested_amounts.get(address, (None, None))
|
||||||
except:
|
except Exception:
|
||||||
amount, currency = None, None
|
amount, currency = None, None
|
||||||
self.qr_window.set_content( address, label, amount, currency )
|
self.qr_window.set_content( address, label, amount, currency )
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class Plugin(BasePlugin):
|
||||||
try:
|
try:
|
||||||
seq = self.wallet.get_address_index(address)
|
seq = self.wallet.get_address_index(address)
|
||||||
index = seq[1][1]
|
index = seq[1][1]
|
||||||
except:
|
except Exception:
|
||||||
print "cannot get index"
|
print "cannot get index"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Plugin(BasePlugin):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
proc.process_one()
|
proc.process_one()
|
||||||
except:
|
except Exception:
|
||||||
# User closed the preview window
|
# User closed the preview window
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -99,12 +99,12 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
amount = self.gui.main_window.read_amount(unicode( self.gui.main_window.amount_e.text()))
|
amount = self.gui.main_window.read_amount(unicode( self.gui.main_window.amount_e.text()))
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Amount'), _('OK'))
|
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Amount'), _('OK'))
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
fee = self.gui.main_window.read_amount(unicode( self.gui.main_window.fee_e.text()))
|
fee = self.gui.main_window.read_amount(unicode( self.gui.main_window.fee_e.text()))
|
||||||
except:
|
except Exception:
|
||||||
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Fee'), _('OK'))
|
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Fee'), _('OK'))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ def main(address):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
address = sys.argv[1]
|
address = sys.argv[1]
|
||||||
except:
|
except Exception:
|
||||||
print "usage: get_balance <bitcoin_address>"
|
print "usage: get_balance <bitcoin_address>"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
main(address)
|
main(address)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from electrum import Network
|
||||||
|
|
||||||
try:
|
try:
|
||||||
addr = sys.argv[1]
|
addr = sys.argv[1]
|
||||||
except:
|
except Exception:
|
||||||
print "usage: get_history <bitcoin_address>"
|
print "usage: get_history <bitcoin_address>"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ def process_request(amount, confirmations, expires_in, password):
|
||||||
amount = float(amount)
|
amount = float(amount)
|
||||||
confirmations = int(confirmations)
|
confirmations = int(confirmations)
|
||||||
expires_in = float(expires_in)
|
expires_in = float(expires_in)
|
||||||
except:
|
except Exception:
|
||||||
return "incorrect parameters"
|
return "incorrect parameters"
|
||||||
|
|
||||||
account = wallet.accounts["m/0'/0"]
|
account = wallet.accounts["m/0'/0"]
|
||||||
|
|
|
@ -4,7 +4,7 @@ import sys, time, electrum
|
||||||
|
|
||||||
try:
|
try:
|
||||||
addr = sys.argv[1]
|
addr = sys.argv[1]
|
||||||
except:
|
except Exception:
|
||||||
print "usage: watch_address <bitcoin_address>"
|
print "usage: watch_address <bitcoin_address>"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue