Hi, With a X11 build of Qt, if there's no X server available, or the DISPLAY env var is invalid, (ssh batch mode, ...) then Qt exits (like in exit(1); ), with the message : cannot connect to X server
That's a non-feature of Qt to not raise exceptions, in order to be lighweight or more compatible, but in the python side we'd expect a traceback, and that could be considered as a bug. You can reproduce it simply: DISPLAY="" python -c "from PyQt4 import QtGui; app = QtGui.QApplication([]); print 'Not executed' " A workaround is to trying to check if on an X11 build, and trying to assess the validity of DISPLAY env var with: if hasattr(QtGui, 'QX11Info'): display = os.environ.get('DISPLAY') if display is None or not re.search(':\d', display): raise RuntimeError('Invalid DISPLAY variable') But I think it'd be great if it could be raised within pyqt. -- J
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt