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

Problem calling attributes containing '-' #99

Open
mohanex opened this issue Feb 26, 2024 · 0 comments
Open

Problem calling attributes containing '-' #99

mohanex opened this issue Feb 26, 2024 · 0 comments

Comments

@mohanex
Copy link

mohanex commented Feb 26, 2024

Hello,

I have been using the Munch library for a while now.
On my python code, I imported some parametrs from an YAML file and then tried to iterate on them one by one. The problem is that some parametrs with the '-' caracter are not accepted and my python 3.11.7 throws :

Traceback (most recent call last):
  File "PATH\venv\Lib\site-packages\munch\__init__.py", line 116, in __getattr__
    return object.__getattribute__(self, k)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Munch' object has no attribute 'llm'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "PATH\venv\Lib\site-packages\munch\__init__.py", line 119, in __getattr__
    return self[k]
KeyError: 'llm'

My key is llm-api but the Munch object does just recongnize llm and not the rest of the key.
Is this a common problem?

PS : I resolved this issue by replacing '-' to '_' on my YAML file and it works perfectly, otherways I just want to report this because it made me crazy for some hours and also to help some beautiful lost soul in the future.

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

No branches or pull requests

1 participant