본문 바로가기

오류모음집/python

🐍 TypeError: object dict can't be used in 'await' expression

반응형
발단 사항 -> 비동기 작업중 발생 

 

발단 원인   ->  사용하는 함수 중 비동기 함수로 설정 안한 것이 있으면 일어나는 에러 

내가 사용하는 함수 중 비동기가 함수 가 없는지 확인하고 없으면 async 만들어주기 

 

 

example) 

import asyncio
from typing import Dict


def not_data_sync(**data: Dict) -> Dict:
	return data
  
  
 
async def main_function() -> int:
	data = not_data_sync({"test": "error"})  # ERROR!! 
    return data
    

asyncio.run(main_function())

 

반응형