alexferl / vyper

Python configuration with (more) fangs
MIT License
144 stars 21 forks source link

AttributeError: module 'vyper' has no attribute 'set_default' #40

Closed MareoRaft closed 2 years ago

MareoRaft commented 3 years ago

Maybe I'm doing something wrong, but I did the reasonable thing and tried out the first example in the README.

requirements.txt:

vyper-config==1.0.0

python file:

import vyper as v
v.set_default('ContentDir', 'content')

and I obtained the error AttributeError: module 'vyper' has no attribute 'set_default'.

Any idea as to how to fix this error? Also, perhaps a Getting Started section or a tutorial would be helpful for newcomers.

jjmerri commented 2 years ago

You might be running into the same problem as me (which I havent solved). vyper is a different module. This module is vyper-config but I cant figure out how to import it.

MareoRaft commented 2 years ago

@jjmerri Thanks for the comment. Glad to know I'm not the only one with this issue.

The name of a module in PyPI and the name of a module when importing can be different. This module is called vyper-config in PyPI but it is imported with import vyper. To the best of my knowledge it is the correct module.

You can run pip list | grep vyper in the terminal to see if you have any other modules with "vyper" in their name installed. You can uninstall the other ones in order to ensure that import vyper is not importing one of the other ones instead of this one.

MareoRaft commented 2 years ago

@alexferl Perhaps you took a cursory glance at my comment and thought it was a resolution. The issue of receiving AttributeError: module 'vyper' has no attribute 'set_default' still has not been resolved.

alexferl commented 2 years ago

@MareoRaft indeed, I did. I just noticed your import is what's wrong. It should be:

from vyper import v
v.set_default('ContentDir', 'content')

Sorry about that, my brain must've rearranged it when I first read it.