Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: populationsim.util does not exist #138

Open
majthehero opened this issue Aug 13, 2021 · 3 comments
Open

Bug: populationsim.util does not exist #138

majthehero opened this issue Aug 13, 2021 · 3 comments

Comments

@majthehero
Copy link

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.

@bstabler bstabler self-assigned this Aug 18, 2021
@bstabler
Copy link
Contributor

Hi. I cannot recreate this issue. What version of populationsim and activitysim do you have installed? And what command are you using to run the example? Thanks.

@bstabler bstabler removed their assignment Nov 19, 2021
@friedtea15
Copy link

I had the same issue, following the installation guide here: https://activitysim.github.io/populationsim/getting_started.html#installation#150

@majthehero solution worked here

@bettinardi
Copy link
Collaborator

I wonder if updating the example #90 - will resolve this issue by making it obsolete

@bettinardi bettinardi added this to the Phase 9 Priorities milestone Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants