From: Jens Steinhauser Date: Wed, 14 Oct 2015 22:29:45 +0000 (+0200) Subject: Handle a failing import of the sigrok bindings. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4946c320ea47806eb336f045c1b936df4d793683;p=sigrok-meter.git Handle a failing import of the sigrok bindings. --- diff --git a/sigrok-meter b/sigrok-meter index c991fad..63415f7 100755 --- a/sigrok-meter +++ b/sigrok-meter @@ -21,7 +21,6 @@ ## import argparse -import sigrok.core as sr import sys import textwrap import signal @@ -95,10 +94,16 @@ if __name__ == '__main__': qtcompat.load_modules(args.pyside) QtCore = qtcompat.QtCore QtGui = qtcompat.QtGui - import mainwindow app = QtGui.QApplication([]) + try: + import sigrok.core as sr + except Exception as e: + QtGui.QMessageBox.critical(None, 'Error starting sigrok-meter', + 'Unable to use the sigrok python bindings:\n{}'.format(e)) + sys.exit(1) + # Initialize modules that need a QApplication to exist. import settings settings.init() @@ -114,6 +119,7 @@ if __name__ == '__main__': except: sys.exit('Error: invalid log level.') + import mainwindow s = mainwindow.MainWindow(context, args.drivers) s.show()