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

TypeError: 'module' object is not callable #14

Closed
hagfelsh opened this issue Apr 1, 2020 · 10 comments
Closed

TypeError: 'module' object is not callable #14

hagfelsh opened this issue Apr 1, 2020 · 10 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@hagfelsh
Copy link

hagfelsh commented Apr 1, 2020

Python version
3.6.9

Package version
0.18.1

Current behavior (bug description)
on the very first line where i call the benedict() class, an exception is thrown:

Traceback (most recent call last):
  File "benedict-test.py", line 18, in <module>
    d = benedict()
TypeError: 'module' object is not callable

This even happens when creating a dictionary just as your usage examples demonstrate.

Expected behavior
see above!

@hagfelsh hagfelsh added the bug Something isn't working label Apr 1, 2020
@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Apr 1, 2020

Check how you import it.
I think you are doing:

import benedict

instead of:

from benedict import benedict

@fabiocaccamo fabiocaccamo added invalid This doesn't seem right and removed bug Something isn't working labels Apr 1, 2020
@hagfelsh
Copy link
Author

hagfelsh commented Apr 1, 2020

I did originally have that mistake, yes! However here's the whole file: (the traceback is the same of course)

from benedict import benedict

d = benedict()
d['profile', 'firstname'] = 'Fabio'
print(d)

@fabiocaccamo
Copy link
Owner

I don’t think the traceback is the same, could you check it please?

@hagfelsh
Copy link
Author

hagfelsh commented Apr 2, 2020

Sure thing!

Traceback (most recent call last):
  File "/home/hagfelsh/.PyCharmCE2019.3/config/scratches/benedict-test.py", line 3, in <module>
    d = benedict()
TypeError: 'module' object is not callable

Process finished with exit code 1

In pycharm there are some deeper parts of the traceback. I'm new to python so I'm not sure what in here is valuable. Here are some that look like they might be:

exception/type/args = {getset_descriptor} <attribute 'args' of 'BaseException' objects>

traceback_frame/stack[4] = 'frame: <module> [pydevd.py:2127]  id:35889816'

@fabiocaccamo
Copy link
Owner

I don't think this is a library problem, this snipped of code works perfectly:

from benedict import benedict

d = benedict()
d['profile', 'firstname'] = 'Fabio'
print(d)

and prints:

{'profile': {'firstname': 'Fabio'}}

@hagfelsh
Copy link
Author

hagfelsh commented Apr 2, 2020

Well that's interesting! I wonder what's wrong in my environment! I'll cook up a new venv and try it there. Thanks for such fast responses :)

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Apr 2, 2020

Ok, don't worry! If you find any bug please provide also a failing test case to speed up bug fixing.

@mthbrown
Copy link

mthbrown commented Mar 1, 2023

In case anyone runs into this in the future, this is probably due to you installing the wrong benedict module. Instead of:

pip install benedict

you should run:

pip install python-benedict

@fabiocaccamo
Copy link
Owner

@mthbrown thanks for clarifying the issue, it will surely be useful to someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants