Thursday 15 September 2011

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


I have installed redis-py on CentOS and Ubuntu, I get the same error on both of them when trying to access it

I'll do this:

  & gt; & Gt; & Gt; Import redis & gt; & Gt; & Gt; R = redis.Redis (host = 'localhost', port = 6379, db = 0)   

But if I change the directory then this will return the error.

  & gt; & Gt; & Gt; Import tracebacks (most recent call final): File "& lt; stdin>", line 1, & lt; Module & gt; File "redis.py", line 4, & lt; Module & gt; Print redis .__ version__ Attribute: There is no attribute '__version__' in the 'module' object   

always returns an error in trying with a .py script Any ideas what I am doing wrong, and how can I fix it? Perhaps a novice Python thing ...

You are doing a module name What you are working on is Redis.py and importing Python to do that instead of the actual redis module Do not, or change sys.path to make sure that the current working directory is in the list of directories to search instead of the last .

No comments:

Post a Comment