#๐Ÿ”’ object NoneType can't be used in 'await' expression

35 messages ยท Page 1 of 1 (latest)

hushed lily
#

Hi all, I'm trying to test my database I/O functions, but I keep getting stuck on that error
Here is the full traceback: https://mb.spiritthewalf.co.uk/80b314b18f39da1a7b

My database code can be found here: database definitions and here: database I/O

The connection and session tests here pass with no issues, but the test of the coroutines themselves, found in the I/O link above, fail with the titled error and traceback above
Any help is appreciated
Modules used:
Asyncio
Asyncpg
Sqlalchemy

hybrid compassBOT
#

@hushed lily

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hearty panther
#

Have you tried using a debugger? If so what result you got?

hushed lily
#

I have not

#

I'm running now

#

It's a part of a larger project involving a discord bot, but that's not being used yet

#

exit code 0

feral lion
#

lemme take a look

feral lion
#

!e ```py
import asyncio

def f():
pass

async def main():
await f()

asyncio.run(main())

#
# Traceback
  File "/home/main.py", line 7, in main
    await f()
TypeError: object NoneType can't be used in 'await' expression
feral lion
hushed lily
#

I thought because I was working in async, it had to be awaited, I've awaited it before with no issues

feral lion
#

oh damn

hushed lily
#

Most of my stack is

#

I have gitea, sharex, mystbin, mailcow

feral lion
#

awesome dude thumbsup

feral lion
hushed lily
#

it adds an entry to a transaction, a session is a connection
but you can roll it back, which comes in handy with things like this

hushed lily
#

well it works now, was an issue with awaiting it ig

feral lion
#

yeah i was gonna say

#

what happens if you just dont await it

hushed lily
#

works flawlessly

feral lion
hushed lily
#

welp am dum ig lol

feral lion
#

!close to close the post

hushed lily
#

ty!

feral lion
hushed lily
#

turns out I can't read tracebacks

#

!close

hybrid compassBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.