openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #26077
Re: [Merge] lp:~tomasgroth/openlp/bugfixes13 into lp:openlp
Review: Needs Fixing
Both IOError and OSError have some useful attributes. Use something like this instead.
try:
...
except (OSError, IOError) as ose:
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Export setting error'),
translate('OpenLP.MainWindow', 'An error occurred while your settings: '
'%s') % ose.strerror,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
------------------------------------------------------------
>>> open('boo', 'r')
IOError: [Errno 2] No such file or directory: 'boo'
>>> try:
>>> open('boo', 'r')
>>> except IOError as ose:
>>> print ose.strerror
No such file or directory
--
https://code.launchpad.net/~tomasgroth/openlp/bugfixes13/+merge/248975
Your team OpenLP Core is subscribed to branch lp:openlp.
References