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

Issue with reading config #162

Closed
eltonelero opened this issue May 10, 2024 · 0 comments · Fixed by #181
Closed

Issue with reading config #162

eltonelero opened this issue May 10, 2024 · 0 comments · Fixed by #181

Comments

@eltonelero
Copy link

eltonelero commented May 10, 2024

In core.py the config is read by

with open(base_config) as f:
        config = yaml.load(f, Loader=yaml.FullLoader)
    if exists(custom_config):
        with open(custom_config) as f:
            config.update(yaml.load(f, Loader=yaml.FullLoader))

This can lead to encoding issues on some machines.
Leading to an error like this:

yaml.reader.ReaderError: unacceptable character #x009f: special characters are not allowed

I would suggest changing it to

with open(base_config, encoding='utf8') as f:
        config = yaml.load(f, Loader=yaml.FullLoader)
    if exists(custom_config):
        with open(custom_config, encoding='utf8') as f:
            config.update(yaml.load(f, Loader=yaml.FullLoader))

Worked for me. Cheers.

lkstrp added a commit to lkstrp/powerplantmatching that referenced this issue Jul 22, 2024
@lkstrp lkstrp closed this as completed in 8885715 Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant