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
But add it as a default option so that config files may continue to use
it as an interpolation value.
Saving config files whenever a value is set breaks this, as it actually
saves the default value to disk. Without adding a guard against it, it
actually writes any provided default values to disk before loading the
existing config file, actually wiping out the user's config completely.
So this commit removes the overridden methods that save back to disk.
No labscript code actually sets config values except for some code in
the BLACS plugins `__init__.py`, which adds the list of available
plugins. Not writing this back to disk is fine. If we ever make GUI
interfaces for manipulating the config file, it is poor form to just
overwrite the user's config file anyway, which may re-order sections and
remove comments. For that we would want to use something like
https://pypi.org/project/ConfigUpdater/.
Also simplify the code that gets the config path. There is only one
place on disk for config paths now, and if it doesn't exist the user
will get a FileNotFoundError with the full path, so I don't think there
is a strong need to wrap that error in one written by us that basically
says the same thing!
This change removes the hostname and config_prefix variables. These
variables are imported (unused) by lyse and runviewer, so I will remove
them from those projects. They are also imported and used by BLACS to
construct its config filepath. I will modify BLACS to instead put its
config file in the standard config file locations for apps.
Fixes#22
# read all files in the config path if it is a list (self.config_path only
60
+
# contains one string):
61
+
self.read(config_path)
93
62
94
63
try:
95
64
forsection, optionsinrequired_params.items():
96
65
foroptioninoptions:
97
-
self.get(section,option)
98
-
99
-
exceptconfigparser.NoOptionErrorase:
100
-
raiseException('The experiment configuration file located at %s does not have the required keys. Make sure the config file containes the following structure:\n%s'%(config_path, self.file_format))
101
-
102
-
103
-
# Overwrite the add_section method to only attempt to add a section if it doesn't
104
-
# exist. We don't ever care whether a section exists or not, only that it does exist
0 commit comments