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

KeyError: 'ENVIRONMENTAL_VARIABLES' #40

@lam-sys

Description

@lam-sys
          > 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions