I'm getting a SyntaxError: f-string: empty expression not allowed
I'm not sure (at all) what this means
I've tried moving around the code & looked online but I've got no different results
The code is:
@client.command()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send(f"Loaded the {} module!".format(extension))
It's for cogs & I'm sure I've got everything else right, I'm not sure though
If anyone knows what to do then please tell me, thx
The problem is the empty {} in the f-string. F-strings require a variable name between the braces. The line with the string should be:
await ctx.send(f"Loaded the {extension} module!")
Or
await ctx.send("Loaded the {} module!".format(extension))
Hope this helps.
If you want to keep your code structure the way it is, you can also do like this:
await ctx.send(f"Loaded the {{}} module!".format(extension))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With