Py3: fix "err has no attribute message"

This commit is contained in:
DeepSOIC 2017-11-21 18:34:33 +03:00
parent 804a703333
commit 6cb43a78ae
2 changed files with 3 additions and 2 deletions

View File

@ -55,6 +55,7 @@ class SelectionError(FreeCAD.Base.FreeCADError):
'''Error that isused inside Gui command code'''
def __init__(self, title, message):
self.message = message
self.args = (message,)
self.title = title
def msgError(err):
@ -62,7 +63,7 @@ def msgError(err):
if hasattr(err, "isCancelError") and err.isCancelError: return #workaround
mb = QtGui.QMessageBox()
mb.setIcon(mb.Icon.Warning)
mb.setText(err.message)
mb.setText(str(err))
if type(err) is SelectionError:
mb.setWindowTitle(err.title)
else:

View File

@ -378,7 +378,7 @@ def Subsequence_LinkDict(link_dict, traversal = TRAVERSAL_MODES[0], loop = LOOP_
# trim them to shortest subsequence
if n_seq is None:
raise SubsequencingError_LinkValue("In supplied links, nothing to loop over compounds was found. Key-by-key errors follow: {err_list}"
.format(err_list= "\n".join([repr(key)+": "+err_dict[key].message for key in err_dict])))
.format(err_list= "\n".join([repr(key)+": "+str(err_dict[key]) for key in err_dict])))
for key in ret_dict.keys():
seq = ret_dict[key]
seq = seq[0:n_seq]