-3

my code is on down and I'm getting error 'SyntaxError: invalid syntax' on args

   @client.command(pass_context=True)
   async def render(*args, message):
      """Renders A Growtopia World"""
      mesg = ' '.join(args)
      await client.say(":earth_americas: World Render:")
      return await client.say('https://www.growtopiagame.com/worlds/'mesg'.png')

2 Answers 2

0

*args, **kwargs always come at the end of the parameters.

async def render(message, *args):
    ...

is correct.

Sign up to request clarification or add additional context in comments.

Comments

0

Sure it's not a Syntax Error on that 'mesg' at the last line? Because that's not the way of concatenating strings in Python.

There are many ways to format or concatenate strings (the most obvious one being just adding them like this: string_sum = string1 + string2), but my personal favorite for string formatting when combining with variables and such, if on Python 3.6+, are f-strings (https://cito.github.io/blog/f-strings/).

So in this case you'd do client.say(f'https://www.growtopiagame.com/worlds/{mesg}.png')

(P-EDIT: Godron is kinda correct depending on if Python 2 or 3. See this SO answer for more details https://stackoverflow.com/a/5940226/4192226)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.