Open seanpearsonuk opened 1 year ago
Fluent user story 750088
We can do some work to mitigate this in flobject.py.
Latest:
>>> surf = solver.solution.report_definitions.surface
>>> rd1 = surf.create("rd1")
>>> rd1.surface_names = "wall"
>>> rd1.surface_names()
['wall']
>>> rd1.surface_names = 24
Error: wta(1st) to symbol->string
Error Object: 24
Traceback (most recent call last):
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\flobject.py", line 546, in __setattr__
return attr.set_state(value)
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\flobject.py", line 271, in set_state
return self.flproxy.set_var(self.path, self.to_scheme_keys(state))
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\flproxy.py", line 5, in set_var
return scheme.fl_set_var(path, value)
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\scheme.py", line 21, in newf
return f(*args, **kwds)
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\scheme.py", line 98, in fl_set_var
return _fl_set_var(path, value)
RuntimeError: wta(1st) to symbol->string
Error Object: 24
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\flobject.py", line 550, in __setattr__
raise allowed_values_error(name, value, allowed) from ex
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\error_message.py", line 27, in allowed_values_error
return ValueError(allowed_name_error_message(context, trial_name, allowed_values))
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\error_message.py", line 18, in allowed_name_error_message
matches = closest_allowed_names(trial_name, allowed_values)
File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent24.1\cortex\pylib\flapi\error_message.py", line 9, in closest_allowed_names
return f(cutoff=0.6, n=5) or f(cutoff=0.3, n=1)
File "C:\ANSYSDev\devZ3\vNNN\commonfiles\CPython\3_10\winx64\Release\python\lib\difflib.py", line 701, in get_close_matches
s.set_seq2(word)
File "C:\ANSYSDev\devZ3\vNNN\commonfiles\CPython\3_10\winx64\Release\python\lib\difflib.py", line 248, in set_seq2
self.__chain_b()
File "C:\ANSYSDev\devZ3\vNNN\commonfiles\CPython\3_10\winx64\Release\python\lib\difflib.py", line 280, in __chain_b
for i, elt in enumerate(b):
TypeError: 'int' object is not iterable
So, this is an improvement. This means that we can catch TypeError
s in flobject.py, do the type checking in the catch block and then escalate to an appropriate, meaningful exception.
OTOH, we are accepting string for string list. Is this intentional.
@h-krishnan, @gyeole was it an intentional change that this is now accepted:
>>> rd1.surface_names = "wall"
>>> rd1.surface_names()
['wall']
E.g.,
Requires e.g., a
TypeError
such asNext I change the value of the bool per_surface to an integer, and this is accepted and reflected in the new state:
I change the integer, average_over, to a boolean and this causes another low-level error: