On 21.12.2010 22:25, ext Thomas Perl wrote:

Another situation where that happens is when you construct a
QApplication without $DISPLAY set:

$ export DISPLAY=
$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from PySide.QtGui import QApplication
app = QApplication([])
PySideApp: cannot connect to X server
$ echo $?
1

In this case, I think it would be good to have an exception at the
Python level, as this error is something that only happens when
$DISPLAY is not set, so catching the exception and dealing with it
(i.e. by printing a nice error message like "You do not have $DISPLAY
set.") makes more sense. Should I turn this into a bug/feature
request?

Again, in my opinion, the guideline should be that we should try to catch the C++ errors whenever we can and cast Python exceptions for them. Of course, in many cases this might not be feasible due to performance or implementation issues, so reason must prevail. :-)

In this specific case, I agree that it would be nice to catch the error if it's possible, so go ahead and file a bug if you feel like it.

Cheers,

ma.
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to