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

AttributeError: module 'redis.asyncio' has no attribute 'exceptions' #919

Closed
ba1dr opened this issue May 1, 2022 · 4 comments
Closed

AttributeError: module 'redis.asyncio' has no attribute 'exceptions' #919

ba1dr opened this issue May 1, 2022 · 4 comments

Comments

@ba1dr
Copy link

ba1dr commented May 1, 2022

Traceback (most recent call last):
  File "/myproject/venv/lib/python3.10/site-packages/socketio/asyncio_pubsub_manager.py", line 151, in _thread
    async for message in self._listen():  # pragma: no branch
  File "/myproject/venv/lib/python3.10/site-packages/socketio/asyncio_redis_manager.py", line 100, in _listen
    async for message in self._redis_listen_with_retries():
  File "/myproject/venv/lib/python3.10/site-packages/socketio/asyncio_redis_manager.py", line 87, in _redis_listen_with_retries
    except aioredis.exceptions.RedisError:
AttributeError: module 'redis.asyncio' has no attribute 'exceptions'

Most likely the file asyncio_redis_manager.py should be fixed as:

try:
    from redis import asyncio as aioredis
    from redis.exceptions import RedisError
except ImportError:
    try:
        import aioredis
        from aioredis.exceptions import RedisError
    except ImportError:
        aioredis = None

...
try
    ...
except RedisError:
    ....
@miguelgrinberg
Copy link
Owner

@ba1dr Can I ask you to confirm that the main branch fixes the issue? Thanks!

@ba1dr
Copy link
Author

ba1dr commented May 1, 2022

@miguelgrinberg Works for me for my use case now, thank you. Great app by the way!

@luebke-dev
Copy link

@miguelgrinberg when will this fix be on pypi?

@miguelgrinberg
Copy link
Owner

@SebastianLuebke sorry for the delay. 5.7.0 is now out with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants