Commit 04b9d531 authored by Louis Beauloye's avatar Louis Beauloye
Browse files

Fix message TypeError

parent fb117654
......@@ -856,7 +856,11 @@ class MbsDirdyn(object):
except TypeError as err:
# if wrong type in integrator or compute_QC
raise TypeError("{:} is {:}, can not be casted from {:}.".format(key, options[key]['convert'], type(value))).with_traceback(err.__traceback__) from None
if key == 'integrator':
raise TypeError("{:} is int or str, can not be casted from {:}.".format(key, type(value))).with_traceback(err.__traceback__) from None
elif key == 'compute_Qc':
raise TypeError("{:} is list or numpy.ndarray, can not be casted from {:}.".format(key, type(value))).with_traceback(err.__traceback__) from None
def get_options(self, *args):
"""
......
......@@ -619,8 +619,8 @@ class MbsInvdyn(object):
except TypeError as err:
# if wrong type in motion
raise TypeError("{:} is {:}, can not be casted from {:}.".format(key, options[key]['convert'], type(value))).with_traceback(err.__traceback__) from None
if key == 'motion':
raise TypeError("{:} is str or int, can not be casted from {:}.".format(key, type(value))).with_traceback(err.__traceback__) from None
def get_options(self, *args):
"""
......
......@@ -535,10 +535,7 @@ class MbsModal(object):
raise TypeError("{:} is an invalid option name.".format(key))
try:
c_name = options[key]['c_name']
if key == 'store_results':
self.store_results = int(value)
else:
setattr(self.mbs_modal_ptr.contents.options.contents, c_name, options[key]['convert'](value))
setattr(self.mbs_modal_ptr.contents.options.contents, c_name, options[key]['convert'](value))
except ValueError as err:
raise TypeError("{:} is {:}, can not be casted from {:}.".format(key, options[key]['convert'], type(value))).with_traceback(err.__traceback__) from None
except AttributeError as err:
......
......@@ -364,7 +364,8 @@ class MbsSolvekin(MbsInvdyn):
except TypeError as err:
# if wrong type in motion
raise TypeError("{:} is {:}, can not be casted from {:}.".format(key, options[key]['convert'], type(value))).with_traceback(err.__traceback__) from None
if key == 'motion':
raise TypeError("{:} is str or int, can not be casted from {:}.".format(key, type(value))).with_traceback(err.__traceback__) from None
def get_options(self, *args):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment