Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 452 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
redis-py AttributeError: 'module' object has no attribute

#1
I installed redis-py on CentOS and Ubuntu. On both I get the same error when trying to access it.

redis-py AttributeError: 'module' object has no attribute

If I use the python prompt in the same directory as the source this will work:

>>> import redis
>>> r = redis.Redis(host='localhost', port=6379, db=0)

but if I change directories it will give the error.

>>> import redis
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "redis.py", line 4, in <module>
print redis.__version__
AttributeError: 'module' object has no attribute '__version__'


Trying with a `.py` script always gives the error. Any idea what I'm doing wrong, and how to fix it. Probably a newbie Python thing...
Reply

#2
You're naming a module you're working on `redis.py` and Python is importing that instead of the real `redis` module. Don't do that, or change `sys.path` to make sure the current working directory is *last* rather than first in the lists of directories to search.
Reply

#3
i have this error in tornado and it was because i install redis on python 2.7 and install in python3 too , i uninstall redis from python2.7 and re_install in python3 and solve the Problem!
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through