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.

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to