X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=gui%2Fqt%2Fconsole.py;h=c0b08c5eb12d6908dd5b789634115ed7930813b5;hb=3cbe11a42473af52e7c5e002c36aaaf32646f627;hp=9ff94d22640f4114efe13b322c1f3fc834db722e;hpb=9e70c7fae4af8351bfa133b57b204d387302fe4e;p=electrum-nvc.git diff --git a/gui/qt/console.py b/gui/qt/console.py index 9ff94d2..c0b08c5 100644 --- a/gui/qt/console.py +++ b/gui/qt/console.py @@ -4,7 +4,7 @@ import sys, os, re import traceback, platform from PyQt4 import QtCore from PyQt4 import QtGui -from electrum import util +from electrum_nvc import util if platform.system() == 'Windows': @@ -39,6 +39,8 @@ class Console(QtGui.QPlainTextEdit): def run_script(self, filename): with open(filename) as f: script = f.read() + + # eval is generally considered bad practice. use it wisely! result = eval(script, self.namespace, self.namespace) @@ -209,6 +211,7 @@ class Console(QtGui.QPlainTextEdit): sys.stdout = stdoutProxy(self.appendPlainText) try: try: + # eval is generally considered bad practice. use it wisely! result = eval(command, self.namespace, self.namespace) if result != None: if self.is_json: @@ -216,10 +219,11 @@ class Console(QtGui.QPlainTextEdit): else: self.appendPlainText(repr(result)) except SyntaxError: + # exec is generally considered bad practice. use it wisely! exec command in self.namespace except SystemExit: self.close() - except: + except Exception: traceback_lines = traceback.format_exc().split('\n') # Remove traceback mentioning this file, and a linebreak for i in (3,2,1,-1):