import os
-try:
- import tomllib
-except ImportError:
- import toml as tomllib
-
class Enum:
"""
self._locked = False
-def load_settings_toml(*, return_toml=False):
- """Load values from settings.toml into os.environ, so that os.getenv returns them."""
+def load_settings_toml():
+ """Load values from settings.toml into os.environ, so that os.getenv returns them.
+ Note: This does not work in MicroPython because of the tomllib module not being available.
+ """
+ try:
+ import tomllib
+ except ImportError:
+ import toml as tomllib
+
if not os.path.isfile("settings.toml"):
- raise FileNotFoundError("settings.toml not cound in current directory.")
+ raise FileNotFoundError("settings.toml not found in current directory.")
print("settings.toml found. Updating environment variables:")
with open("settings.toml", "rb") as toml_file:
os.environ[key] = str(value)
print(f" - {key} added")
- if return_toml:
- return settings
- return None
+ return settings
def patch_system():