You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the following code on Simvue 1.1.3 produces a traceback:
fromsimvue.clientimportClientclient=Client()
(.venv) timothynunn@L0268-iMac eqm-ml % python test.py
Traceback (most recent call last):
File "/Users/timothynunn/eqm-ml/.venv/lib/python3.10/site-packages/simvue/utilities.py", line 251, in wrapper
return class_func(self, *args, **kwargs)
File "/Users/timothynunn/eqm-ml/.venv/lib/python3.10/site-packages/simvue/config/user.py", line 214, in fetch
return SimvueConfiguration(**_config_dict)
File "/Users/timothynunn/eqm-ml/.venv/lib/python3.10/site-packages/pydantic/main.py", line 171, in __init__
self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for SimvueConfiguration
run.mode
Input should be 'offline', 'disabled' or 'online' [type=literal_error]
For further information visit https://errors.pydantic.dev/2.6/v/literal_error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/timothynunn/eqm-ml/test.py", line 3, in <module>
client = Client()
File "/Users/timothynunn/eqm-ml/.venv/lib/python3.10/site-packages/simvue/client.py", line 109, in __init__
self._user_config = SimvueConfiguration.fetch(
File "/Users/timothynunn/eqm-ml/.venv/lib/python3.10/site-packages/simvue/utilities.py", line 254, in wrapper
raise RuntimeError(error_str)
RuntimeError: `fetch` Validation:
╒═════════╤═════════════════╤═══════════════╤═══════════════════════════════════════════════════╕
│ Input │ Location │ Type │ Message │
╞═════════╪═════════════════╪═══════════════╪═══════════════════════════════════════════════════╡
│ None │ ['run', 'mode'] │ literal_error │ Input should be 'offline', 'disabled' or 'online' │
╘═════════╧═════════════════╧═══════════════╧═══════════════════════════════════════════════════╛
It appears that simvue.config.parameters.DefaultRunSpecifications is typed to only accept literal strings while simvue.config.user.SimvueConfiguration.fetch accepts mode as optional. Therefore, on line 202, _run_mode = mode or _config_dict["run"].get("mode") which equates to _run_mode = None or None. This None is passed to the DefaultRunSpecifications and fails the literal check.
The text was updated successfully, but these errors were encountered:
timothy-nunn
changed the title
SimvueConfiguration Pydantic
SimvueConfiguration Pydantic fails when creating client
Dec 10, 2024
Running the following code on Simvue 1.1.3 produces a traceback:
It appears that
simvue.config.parameters.DefaultRunSpecifications
is typed to only accept literal strings whilesimvue.config.user.SimvueConfiguration.fetch
acceptsmode
as optional. Therefore, on line 202,_run_mode = mode or _config_dict["run"].get("mode")
which equates to_run_mode = None or None
. ThisNone
is passed to theDefaultRunSpecifications
and fails the literal check.The text was updated successfully, but these errors were encountered: