tylergibbs2 / async2rewrite

Automagically converts discord.py async-branch code to rewrite-branch code.
MIT License
20 stars 10 forks source link

Positional expected when keyword is given #6

Closed Supersebi3 closed 6 years ago

Supersebi3 commented 7 years ago

I managed to install the module, but now the module is having problems with my Fun.py extension. The error message says: File "/data/data/com.termux/files/usr/lib/python3.6/site-packages/async2rewrite/transformers.py", line 419, in stateful_edit_message content = call.args[1] IndexError: list index out of range I tried it with and without remove_parens=True, it worked with other files, I have no idea how i could fix this...

Edit: the problem might be f-strings

Supersebi3 commented 7 years ago

The problem might also be seperate, non-async functions I define in that extension as well as in a different file giving the same error

tylergibbs2 commented 7 years ago

Can you send the code from your Fun.py cog?

Supersebi3 commented 7 years ago

https://pastebin.com/QCCGR9Dk

Supersebi3 commented 7 years ago

Are you working on this?

tylergibbs2 commented 7 years ago

Yes, this is being worked on. It involves a complete rewrite of how I handle all functions. For a temporary fix, change line 33 to: await self.bot.edit_message(pongmsg, "{}{}ms!".format(pong, str(int(timedelta_milliseconds(pongmsg.timestamp-ctx.message.timestamp))))) and then run async2rewrite.

Supersebi3 commented 7 years ago

So wait, does that mean the problem are keyword arguments?

Supersebi3 commented 7 years ago

Ok i think i understood it: edit_message needs at least 2 non-keyword argments. I had a different file with the same issue, but I fixed it by changing edit_message(msg, embed=em) to edit_message(msg, "", embed=em)

tylergibbs2 commented 6 years ago

This has been solved with the latest update (0.1.4).