首页 > 解决方案 > 不存在的行上的 Python 期望缩进

问题描述

我感到很困惑。我正在尝试使用 Python 和 Discord.py 制作一个 Discord 机器人。我已经从这里复制了示例代码,现在收到此错误:

  File "C:/Users/****/Documents/Discord/RTSC/J'alami/bot.py", line 27
client.run(TOKEN)
     ^
IndentationError: expected an indented block

现在这是奇怪的事情。从我的代码中可以看出:

import discord

client = discord.Client()
client.run("{this string is secret}")

只有 3 行,到目前为止还不是错误所说的 27 行。
我对 Python 很陌生,所以我可能在这里遗漏了一些明显的东西。
我的 IDE 是 PyCharm 2020.1.1 社区版

非常感谢任何帮助,谢谢!

标签: pythoncompiler-errorspycharmdiscordindentation

解决方案


推荐阅读