I receive following output:
Traceback (most recent call last): File "/home/ec2-user/env/lib64/python3.7/site-packages/redis/connection.py", line 1192, in get_connection raise ConnectionError('Connection has data') redis.exceptions.ConnectionError: Connection has data During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ec2-user/env/lib64/python3.7/site-packages/eventlet/hubs/hub.py", line 457, in fire_timers timer() File "/home/ec2-user/env/lib64/python3.7/site-packages/eventlet/hubs/timer.py", line 58, in __call__ cb(*args, **kw) File "/home/ec2-user/env/lib64/python3.7/site-packages/eventlet/greenthread.py", line 214, in main result = function(*args, **kwargs) File "crawler.py", line 53, in fetch_listing url = dequeue_url() File "/home/ec2-user/WebCrawler/helpers.py", line 109, in dequeue_url return redis.spop("listing_url_queue") File "/home/ec2-user/env/lib64/python3.7/site-packages/redis/client.py", line 2255, in spop return self.execute_command('SPOP', name, *args) File "/home/ec2-user/env/lib64/python3.7/site-packages/redis/client.py", line 875, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/ec2-user/env/lib64/python3.7/site-packages/redis/connection.py", line 1197, in get_connection raise ConnectionError('Connection not ready') redis.exceptions.ConnectionError: Connection not ready
I couldn’t find any issue related to this particular error. I emptied/flushed all redis databases, so there should be no data there. I assume it has something to do with eventlet
and patching. But even when I put following code right at the beginning of the file, the error appears.
import eventlet eventlet.monkey_path()
What does this error mean?
Advertisement
Answer
Finally, I came up with the answer to my problem.
When connecting to redis with python, I specified the database with the number 0
.
redis = redis.Redis(host=example.com, port=6379, db=0)
After changing the dabase to number 1
it worked.
redis = redis.Redis(host=example.com, port=6379, db=1)