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: 'Connection' object has no attribute 'send' #895

Closed
1 task done
llistochek opened this issue Dec 14, 2022 · 1 comment
Closed
1 task done

AttributeError: 'Connection' object has no attribute 'send' #895

llistochek opened this issue Dec 14, 2022 · 1 comment
Labels

Comments

@llistochek
Copy link

llistochek commented Dec 14, 2022

Describe the bug

When using _ContextManager.send AttributeError is raised.

To Reproduce

import aiopg
import asyncio


async def test():
    con = aiopg.connect()
    con.send(None)

asyncio.run(test())

Expected behavior

It shouldn't crash

Logs/tracebacks

Traceback (most recent call last):
  File "/tmp/t.py", line 9, in <module>
    asyncio.run(test())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/tmp/t.py", line 7, in test
    con.send(None)
  File "/home/llist/.local/lib/python3.9/site-packages/aiopg/utils.py", line 61, in send
    return self._coro.send(value)
AttributeError: 'Connection' object has no attribute 'send'

Python Version

Python 3.9.2

aiopg Version

Name: aiopg
Version: 1.4.0
Summary: Postgres integration with asyncio.
Home-page: https://aiopg.readthedocs.io
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: BSD
Location: /home/llist/.local/lib/python3.9/site-packages
Requires: psycopg2-binary, async-timeout
Required-by:

OS

Linux home 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@llistochek llistochek added the bug label Dec 14, 2022
@kshivakumar
Copy link

Isn't send method applicable only to generators?
Why is it present in a context manager object?

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

No branches or pull requests

2 participants