Skip to content

Bug: populationsim.util does not exist #138

@majthehero

Description

@majthehero

I tried to run the examples according to the online documentation.
Currently, the examples do not work:

Traceback (most recent call last):
  File ".\run_populationsim.py", line 15, in <module>
    from populationsim.util import setting
ModuleNotFoundError: No module named 'populationsim.util'

I have checked what the problem is and implemented the function setting(attribute_name) that should be in the util module.
I have successfully managed to run the examples by replacing the import from populationsim.util import setting with a function pasted below:

import yaml

def setting(attribute_name):
  # read settings.yaml located in ./configs/
  with open("./configs/settings.yaml", 'r') as stream:
    try:
      settingsObj = yaml.safe_load(stream)
    except yaml.YAMLError as exc:
      print("oh no, no settings.yaml file in ./configs")
      print(exc)
  
  try:
    return settingsObj[attribute_name]
  except:
    print("oh not, attribute " + attribute_name + " does not exist in settings.yaml")

I suspect that the util module is deprecated and the examples need to be updated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions