resconfig setup crashes if $HOME/.fireworks does not exist
Using the API:
In [1]: from virtmat.middleware.resconfig.cli import setup_resconfig
In [2]: setup_resconfig()
Resource configuration /home/ubuntu/.fireworks/res_config.yaml not found.
Do you want to create it?
Yes(default) | No | Ctrl+C to skip:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 setup_resconfig()
File vre-middleware/src/virtmat/middleware/resconfig/cli.py:36, in setup_resconfig()
34 break
35 if inp.lower() in ('yes', ''):
---> 36 _configure()
37 break
38 continue
File vre-middleware/src/virtmat/middleware/resconfig/cli.py:23, in setup_resconfig.<locals>._configure()
21 print(err)
22 else:
---> 23 cfg.to_file(resconfig_loc)
File python-3.10.12/lib/python3.10/site-packages/fireworks/utilities/fw_serializers.py:273, in FWSerializable.to_file(self, filename, f_format, **kwargs)
271 if f_format is None:
272 f_format = filename.split(".")[-1]
--> 273 with open(filename, "w", **ENCODING_PARAMS) as f:
274 f.write(self.to_format(f_format=f_format, **kwargs))
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.fireworks/res_config.yaml'
Using the texts session
CLI:
(python-3.10.12) $ texts session
Resource configuration /home/ubuntu/.fireworks/res_config.yaml not found.
Do you want to create it?
Yes(default) | No | Ctrl+C to skip:
Traceback (most recent call last):
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/utilities/errors.py", line 223, in wrapper
return func(*args, **kwargs)
File "python-3.10.12/lib/python3.10/site-packages/virtmat/language/cli/run_session.py", line 54, in main
setup_resconfig()
File "python-3.10.12/lib/python3.10/site-packages/virtmat/middleware/resconfig/cli.py", line 36, in setup_resconfig
_configure()
File "python-3.10.12/lib/python3.10/site-packages/virtmat/middleware/resconfig/cli.py", line 23, in _configure
cfg.to_file(resconfig_loc)
File "python-3.10.12/lib/python3.10/site-packages/fireworks/utilities/fw_serializers.py", line 273, in to_file
with open(filename, "w", **ENCODING_PARAMS) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.fireworks/res_config.yaml'
Edited by Ivan Kondov