Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

KeyError: 'ENVIRONMENTAL_VARIABLES' #40

Open
lam-sys opened this issue Jun 23, 2023 · 0 comments
Open

KeyError: 'ENVIRONMENTAL_VARIABLES' #40

lam-sys opened this issue Jun 23, 2023 · 0 comments

Comments

@lam-sys
Copy link

lam-sys commented Jun 23, 2023

          > Hi, Sir or Madam! When running the notebook transfer_learning_demo.ipynb, I met some problem. Firstly, after changing the path of files and python env, it threw the error as follow:
                          Traceback (most recent call last):
                            File "/home/data/aidd/Reinvent//input.py", line 20, in <module>
                              manager = Manager(configuration)
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 13, in __init__
                              self._load_environmental_variables()
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 29, in _load_environmental_variables
                              raise ex
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 24, in _load_environmental_variables
                              environmental_variables = config["ENVIRONMENTAL_VARIABLES"]
                          KeyError: 'ENVIRONMENTAL_VARIABLES'

I am not very clear what should be set in config.json. I just note some code in manager.py like these:

                          import json
                          import os
                          
                          from running_modes.configurations import GeneralConfigurationEnvelope
                          from running_modes.enums.running_mode_enum import RunningModeEnum
                          from running_modes.constructors.running_mode import RunningMode
                          
                          class Manager:
                          
                              def __init__(self, configuration):
                                  self.running_mode_enum = RunningModeEnum()
                                  self.configuration = GeneralConfigurationEnvelope(**configuration)
                                  self._load_environmental_variables()
                          
                              def run(self):
                                  runner = RunningMode(self.configuration)
                                  runner.run()
                          
                              def _load_environmental_variables(self):
                                  try:
                                      project_root = os.path.dirname(__file__)
                                      with open(os.path.join(project_root, '../configs/config.json'), 'r') as f:
                                          config = json.load(f)
                                      #environmental_variables = config["ENVIRONMENTAL_VARIABLES"]
                                      #for key, value in environmental_variables.items():
                                          #os.environ[key] = value
                          
                                  except KeyError as ex:
                                      raise ex

Could you tell me how to set the config.json in Reinvent folder? Thank you very much!

Originally posted by @lam-sys in #31 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant