lushan88a / google_trans_new

A free and unlimited python API for google translate.
MIT License
393 stars 170 forks source link

python 3.9 object NoneType can't be used in 'await' expression #51

Open simbadmorehod opened 2 years ago

simbadmorehod commented 2 years ago

I am new to programming, so please take this into account

Traceback: Google_translator.py", line 6, in translator text = await g.translate(f"{text}", locale) File "C:\Python39\lib\site-packages\async_google_trans_new\main.py", line 241, in translate await s.close() TypeError: object NoneType can't be used in 'await' expression

code: ** from aiogram.types.base import String import async_google_trans_new

async def translator(text: String, locale: String): g = async_google_trans_new.AsyncTranslator() text = await g.translate(f"{text}", locale) return text **

I use a library function call from the asynchronous code of the telegram bot, need translation.