ユーザーが 'uploadAll'を入力したときにフォルダからすべての画像をアップロードできるようにしようとしています。コードは次のとおりです。forループ構文エラーを持つ関数を待ちます
def get_image(path):
image_list = []
for filename in glob.glob(path): #appends opened images from folder
im = Image.open(filename) #into list image_list and returns it
image_list.append(im)
return image_list
async def iter_image(path): #uploads images in the list
for i in get_image(path):
client.send_file(discord.Object(id='SERVER_ID'),i)
@client.command(pass_context=True)
async def uploadAll(self): #Should trigger above method
await iter_image('PATH_TO_FOLDER')
の最後の関数の結果: はTypeError:オブジェクトNoneType式を「待つ」で使用することはできません。私はfor-loopを持っているのでiter_imageを待つことはできません。どのようにしてforループをトリガするイベントループを得ることができるかについての解決策はありますか?ありがとう。
await
を追加する場合、それが動作するはずかなり確信しています。これはデフォルトチャンネルがIDをサーバーと共有するときに機能しましたが、サーバーは「デフォルトチャンネル」という概念が削除されても、このプロパティを持つチャンネルを持つことはできなくなりました。 – squaswin